Changeset 129


Ignore:
Timestamp:
Jun 29, 2017, 7:42:25 AM (18 months ago)
Author:
drazed
Message:

fix loss-of-control on initial login if not docked issue

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main.lua

    r128 r129  
    3434    for itemid, _ in PlayerInventoryPairs() do
    3535        _, name, _, _, shiptype, _, _, containerid, _, _ = GetInventoryItemInfo(itemid)
    36         if targetless.playercaps[shiptype] then -- found a capship!
     36        if targetless.playercaps[shiptype] and containerid > 0 then -- found a capship!
    3737            local stationid = GetInventoryItemLocation(itemid)
    3838            local sectorid = GetSectorIDOfStation(stationid)
     
    226226
    227227function targetless.sectorupdate:OnEvent(eventname, ...)
     228    -- refresh mycaps
     229    targetless.scancaps()
     230
    228231    targetless.RoidList:save()
    229232    targetless.RoidList:load(GetCurrentSectorid())
    230 
    231     -- refresh mycaps
    232     targetless.scancaps()
    233233
    234234    -- re-aquire target after short delay, so missles can lock
     
    304304    targetless.RoidList.allroids = unspickle(LoadSystemNotes(targetless.var.noteoffset) or "") or {}
    305305    targetless.RoidList.sector = GetCurrentSectorid()
    306 
    307 
    308306    targetless.appendiups()
    309307    targetless.RoidList:load(GetCurrentSectorid())
     
    328326    RegisterEvent(targetless.gothit, "PLAYER_GOT_HIT")
    329327    RegisterEvent(targetless.hudtoggle, "HUD_TOGGLE")
    330     RegisterEvent(targetless.scancaps, "SHIP_CHANGED")
     328
     329    -- ideally this would be triggered off SHIP_CHANGED event, but something is up with that one
     330    -- that causes complete loss of control if called on initial load while in an undocked ship
     331    RegisterEvent(targetless.scancaps, "SHIP_SPAWN_CINEMATIC_FINISHED")
    331332end
    332333
Note: See TracChangeset for help on using the changeset viewer.