Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix npc weapon transitioning #317

Merged
merged 2 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- Improved: Going in and out of the settings no longer clips into the player model.
- Fixed: NPC makers not respecting the spawn frequency -1 causing a lot of NPCs being spawned in some cases.
- Fixed: ep1_c17_00a: Don't cancel scripted_sequence on player death.
- Fixed: weapons not properly transitioning for NPCs.

0.9.25
- Improved: Hints will no longer show duplicates, instead it will renew the existing hint that has the same text.
Expand Down
12 changes: 9 additions & 3 deletions gamemode/sv_transition.lua
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,11 @@ function GM:SerializeEntityData(landmarkEnt, ent, playersInTrigger)
data.SaveTable["LambdaVehicle"] = ent:GetNWEntity("LambdaVehicle", nil)
local activeWeapon = ent:GetActiveWeapon()
if IsValid(activeWeapon) then data.ActiveWeapon = activeWeapon:GetClass() end
local npcWeps = ent:GetWeapons()
data.NPCWeapons = {}
for _, v in pairs(npcWeps) do
table.insert(data.NPCWeapons, v:GetClass())
end
elseif ent:IsVehicle() then
data.Type = ENT_TYPE_VEHICLE
if ent:IsGunEnabled() then
Expand Down Expand Up @@ -943,12 +948,13 @@ function GM:CreateTransitionObjects()
if data.IsPassengerSeat == true then ent:SetNWBool("IsPassengerSeat", true) end
if data.Type == ENT_TYPE_NPC then
ent:SetMovementActivity(data.MovementActivity)
--ent:SetMovementSequence(data.MovementSequence)
ent:SetExpression(data.Expression)
ent:SetNPCState(data.NPCState)
for _, v in pairs(data.NPCWeapons) do
ent:Give(v)
end
if data.ActiveWeapon ~= nil then
ent:SetKeyValue("additionalequipment", data.ActiveWeapon)
GAMEMODE:EntityKeyValue(ent, "additionalequipment", data.ActiveWeapon)
ent:SelectWeapon(data.ActiveWeapon)
end
elseif data.Type == ENT_TYPE_VEHICLE then
if data.EnableGun == true then
Expand Down