Preserve flags on unfake, mostly so medics don't stop being medics

This commit is contained in:
toasterpanic 2026-06-04 13:17:51 -04:00
parent 08bd3ecdf1
commit cd7b77914b
2 changed files with 8 additions and 1 deletions

View file

@ -144,6 +144,11 @@ hook.Add("CreateEntityRagdoll", "zcnpci", function(ent, ragdoll)
-- Why is it like this? Fuck if I know, I just know I don't wanna deal with it again. -- Why is it like this? Fuck if I know, I just know I don't wanna deal with it again.
ragdoll.citizentype = ent:GetInternalVariable("citizentype") ragdoll.citizentype = ent:GetInternalVariable("citizentype")
ragdoll.respawn_data = {
flags = ent:GetFlags(),
spawn_flags = ent:GetSpawnFlags()
}
timer.Simple(0, function() timer.Simple(0, function()
if !IsValid(ragdoll) then return end if !IsValid(ragdoll) then return end

View file

@ -439,6 +439,9 @@ function MODULE:PhysicsSimulate(phys, dt)
ent:SetSkin(target:GetSkin()) ent:SetSkin(target:GetSkin())
ent:AddFlags(target.respawn_data.flags)
ent:AddSpawnFlags(target.respawn_data.spawn_flags)
if target.citizentype then if target.citizentype then
ent:SetKeyValue("citizentype", target.citizentype) ent:SetKeyValue("citizentype", target.citizentype)
end end
@ -497,7 +500,6 @@ function MODULE:PhysicsSimulate(phys, dt)
self.unfaker:SetNWFloat("fake_start", self.FakeUpStart) self.unfaker:SetNWFloat("fake_start", self.FakeUpStart)
self.unfaker:SetNWFloat("fake_end", self.FakeUpEnd) self.unfaker:SetNWFloat("fake_end", self.FakeUpEnd)
target:SetRenderMode(RENDERMODE_NONE) target:SetRenderMode(RENDERMODE_NONE)
ent:SetRenderMode(RENDERMODE_NONE) ent:SetRenderMode(RENDERMODE_NONE)