Jump to content

TheInput:GetWorldPosition() can return nil?


Tranoze
  • Closed

[00:24:52]: [string "scripts/components/playeractionpicker.lua"]:437: attempt to index local 'position' (a nil value)
LUA ERROR stack traceback:
scripts/components/playeractionpicker.lua:437 in (upvalue) old_DoGetMouseActions (Lua) <415-475>
   self =
      actionfilterstack = table: 000000003FC156B0
      inst = 100173 - wendy (valid:true)
      disable_right_click = false
      DoGetMouseActions = function - ../mods/workshop-1835465557/modmain.lua:222
      containers = table: 000000003FC15E30
      actionfilter = function - scripts/prefabs/player_common.lua:864
      map = Map (00000000401886A0)
   position = nil
   target = nil
   spellbook = nil
   isaoetargeting = false
   wantsaoetargeting = false
   cansee = nil

 

Because isaoetargeting = false, that mean position = TheInput:GetWorldPosition(), and at line 437 position still nil, does that mean GetWorldPosition can return nil?

DoGetMouseActions get called from mod this time, but it seem possible to call it when TheInput:GetWorldPosition() return nil.


Steps to Reproduce

Use alt + tab in window. Rarely happen but does happen.




User Feedback


PlayerActionPicker component's DoGetMouseActions will need to handle the case when position is nil. Input:GetWorldPosition() in input.lua can return nil if the screen projection fails.

Changed Status to Closed

  • Like 2

Share this comment


Link to comment
Share on other sites

9 hours ago, JesseB_Klei said:

PlayerActionPicker component's DoGetMouseActions will need to handle the case when position is nil. Input:GetWorldPosition() in input.lua can return nil if the screen projection fails.

Changed Status to Closed

I search in the game and theres more cases it doesnt handle when Input:GetWorldPosition() return nil, like placer and player controller. Can you handle them as well?

Share this comment


Link to comment
Share on other sites

Please help me, I really want to fix this problem. More than 3,000 days of playing time me and my friends have invested a lot, and we don't want to lose it.
Our 3,000 day games crashed, I found the cause of the crash is scripts/prefabs/wagstaff_npc.lua of 928 lines of code "local x, y, z = inst. Transform: GetWorldPosition()" returns nil, I don't know what to do. Here is my full DebugTrace info;
By the way, the game version is v590113(64bit).
============ DebugTrace ============
[Level 1]
    source: [C]
    name: assert
    namewhat: global
    func: function: 000000000F4BB620
    Local(s):
        (*temporary): <nil> nil
        (*temporary): <string> Something is wrong: v1 is nil stale component reference?
[Level 2]
    source: scripts/util.lua: Line 547 <543-561>
    name: 
    namewhat: 
    func: function: 000000001C597E30
    Local(s):
        v1: <nil> nil
        v2: <nil> nil
        v3: <number> -315.28698730469
        v4: <number> -315.20999145508
[Level 3]
    source: [C]
    name: 
    namewhat: 
    func: 
    Local(s):
        (*temporary): <function> function: 000000000DA47990
[Level 4]
    source: scripts/simutil.lua: Line 68 <63-76>
    name: 
    namewhat: 
    func: function: 000000000E21B980
    Local(s):
        x: <nil> nil
        y: <nil> nil
        z: <nil> nil
        rangesq: <number> 1.#INF
        isalive: <nil> nil
        closestPlayer: <nil> nil
        (for generator): <function> function: 000000000F4BB1D0
        (for state): <table> table: 0000000014D11060
        (for control): <number> 1
        i: <number> 1
        v: <table> 134243 - waxwell
[Level 5]
    source: [C]
    name: 
    namewhat: 
    func: 
    Local(s):
        (*temporary): <function> function: 000000000DA47990
[Level 6]
    source: scripts/prefabs/wagstaff_npc.lua: Line 929 <925-944>
    name: fn
    namewhat: field
    func: function: 000000000FB13B30
    Local(s):
        inst: <table> 109496 - wagstaff_npc_mutations
        x: <nil> nil
        y: <nil> nil
        z: <nil> nil
    Upvalue(s):
        LaunchGameItem: <function> function: 000000000FB138F0
[Level 7]
    source: scripts/scheduler.lua: Line 186 <164-216>
    name: OnTick
    namewhat: method
    func: function: 00000000110928F0
    Local(s):
        self: <table> Running Tasks: 0/0
        tick: <number> 297
        (for generator): <function> function: 000000000F4BBDD0
        (for state): <table> table: 000000003AD23840
        (for control): <table> PERIODIC 109496: 2.875000
        k: <table> PERIODIC 109496: 2.875000
        v: <boolean> true
        already_dead: <boolean> false
    Upvalue(s):
        listrecycler: <table> table: 000000001B8E0DB0
[Level 8]
    source: scripts/scheduler.lua: Line 409 <407-415>
    name: RunScheduler
    namewhat: global
    func: function: 0000000010F3A340
    Local(s):
        tick: <number> 297
[Level 9]
    source: scripts/update.lua: Line 240 <224-298>
    name: 
    namewhat: 
    func: function: 00000000145824A0
    Local(s):
        dt: <number> 0.033333335071802
        tick: <number> 298
        (for index): <number> 297
        (for limit): <number> 298
        (for step): <number> 1
        i: <number> 297
    Upvalue(s):
        last_tick_seen: <number> 296
        StaticComponentUpdates: <table> table: 00000000145

Edited by hunger_venus
additional detail

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...