When the player leaves the game on a boat and then rejoins the game they're teleported to the portal if they're suppose to drown. It's done through DoTaskInTime, reference to which is not saved anywhere. I want to change this behavior, but right now there's no way to change it (at least not ugly one). I suggest changing:
prefabs/player_common.lua:809
inst:DoTaskInTime(0, function() --V2C: HACK! enabled false instead of nil means it was overriden by weregoose on load. -- Please refactor drownable and this block to use POST LOAD timing instead. if inst.components.drownable ~= nil and inst.components.drownable.enabled ~= false then local my_x, my_y, my_z = inst.Transform:GetWorldPosition() if not TheWorld.Map:IsPassableAtPoint(my_x, my_y, my_z) then for k,v in pairs(Ents) do if v:IsValid() and v:HasTag("multiplayer_portal") then inst.Transform:SetPosition(v.Transform:GetWorldPosition()) inst:SnapCamera() end end end end end)
To:
inst.portal_teleport_task = inst:DoTaskInTime(0, function() --V2C: HACK! enabled false instead of nil means it was overriden by weregoose on load. -- Please refactor drownable and this block to use POST LOAD timing instead. if inst.components.drownable ~= nil and inst.components.drownable.enabled ~= false then local my_x, my_y, my_z = inst.Transform:GetWorldPosition() if not TheWorld.Map:IsPassableAtPoint(my_x, my_y, my_z) then for k,v in pairs(Ents) do if v:IsValid() and v:HasTag("multiplayer_portal") then inst.Transform:SetPosition(v.Transform:GetWorldPosition()) inst:SnapCamera() end end inst.portal_teleport_task = nil end end end)
Steps to Reproduce
None
-
3
-
3
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 accountSign in
Already have an account? Sign in here.
Sign In Now