Calling Remove twice on an entity that has the propagator component causes the game to crash.This is due to the OnRemoveEntity function in the component, which I believe was added in a recent update:
function Propagator:OnRemoveEntity() if not (self.inst.components.heater ~= nil and self.inst.components.heater:IsEndothermic()) then local x, y, z = self.inst.Transform:GetWorldPosition() local prop_range = TheWorld.state.isspring and self.propagaterange * TUNING.SPRING_FIRE_RANGE_MOD or self.propagaterange local ents = TheSim:FindEntities(x, y, z, prop_range, nil, nil, TARGET_MELT_ANY_TAGS) -- OnRemoveEntity callback makes FindEntities return a nil in the first slot if the entity that was just removed is in the callback so ipairs cannot work here. for i = 1, #ents do local v = ents[i] if v then v:PushEvent("stopfiremelt") v:RemoveTag("firemelt") end end end end
The first Remove call will mark the entity invalid, the second then crashes the game when nil coordinates are passed into TheSim:FindEntities. This is more a problem for mods, since up to this point (I think) there have been no common crashes regarding calling Remove more than once on an entity, and most mods don't check Entity:IsValid() before doing so.
As a note, it might be worth addressing the issue for future cases by checking for IsValid in OnRemove before removing. Thank you for your time!
local a = c_spawn("log"); a:Remove(); ThePlayer:DoTaskInTime(0, function() a:Remove() end)
Using the command above should cause the game to crash.
There are no comments to display.
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