Skip to content

Commit

Permalink
Merge pull request #278 from GMLambda/fix-doors
Browse files Browse the repository at this point in the history
Fix transitioning doors
  • Loading branch information
ZehMatt authored May 19, 2024
2 parents 6b35680 + b96c670 commit b1c5af1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
0.9.23 (in development)
- Fixed: Transitioning doors have sometimes the wrong rotation.

0.9.22
- Improved: Weapon selection weights, this should improve selecting the next weapon when current one is empty.
Expand Down
19 changes: 5 additions & 14 deletions gamemode/sv_transition.lua
Original file line number Diff line number Diff line change
Expand Up @@ -744,8 +744,6 @@ function GM:CreateTransitionObjects()

DbgPrint("Creating " .. tostring(objCount) .. " transition Objects...")
local entityTransitionData = {}
ignoreKeyIndex = -1 -- ignoreKeyIndex + 1
DbgPrint("IgnoreKeyIndex: " .. ignoreKeyIndex)
for _, data in pairs(objects) do
if data.Ignored == true then continue end
-- NOTE/FIXME: Observed different results on linux
Expand Down Expand Up @@ -773,7 +771,6 @@ function GM:CreateTransitionObjects()
ent.SourceMap = data.SourceMap
ent.ShouldDispatchSpawn = dispatchSpawn
-- Do key values first because we might override a few things with setters.
local keyIndex = 0
for k, v in pairs(data.KeyValues) do
if KEYVALUE_BLACKLIST[k] == true then continue end
v = tostring(v)
Expand All @@ -786,15 +783,9 @@ function GM:CreateTransitionObjects()
ent:SetKeyValue(k, v)
GAMEMODE:EntityKeyValue(ent, k, v)
else
if keyIndex == ignoreKeyIndex then
DbgPrint("IGNORED KEY: " .. k)
else
ent:SetKeyValue(k, v)
GAMEMODE:EntityKeyValue(ent, k, v)
end
ent:SetKeyValue(k, v)
GAMEMODE:EntityKeyValue(ent, k, v)
end

keyIndex = keyIndex + 1
end

for k, v in pairs(data.EntityOutputs or {}) do
Expand All @@ -810,11 +801,12 @@ function GM:CreateTransitionObjects()
end

ent:SetPos(data.Pos)
ent:SetAngles(data.Ang)
if data.Type ~= ENT_TYPE_DOOR then
ent:SetAngles(data.Ang)
end
ent:SetVelocity(data.Vel)
if data.Mdl ~= nil then
ent:SetModel(data.Mdl)
DbgPrint(data.Mdl)
end

ent:SetName(data.Name)
Expand Down Expand Up @@ -922,5 +914,4 @@ function GM:CreateTransitionObjects()
end
end

if ignoreKeyIndex ~= -1 then ignoreKeyIndex = ignoreKeyIndex + 1 end
end

0 comments on commit b1c5af1

Please sign in to comment.