From 79f6cf32ac0bcfbdadb996b25e3d9ffe8d97dd42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Sun, 13 Oct 2024 21:46:45 +0300 Subject: [PATCH 1/2] Fix weapons not properly transitioning for NPCs --- gamemode/sv_transition.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gamemode/sv_transition.lua b/gamemode/sv_transition.lua index 7bdc71a4..38be6949 100644 --- a/gamemode/sv_transition.lua +++ b/gamemode/sv_transition.lua @@ -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 @@ -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 From 1929f48c0819a54d9baf947c75bc029c2c56a581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Sun, 13 Oct 2024 21:47:21 +0300 Subject: [PATCH 2/2] Update changelog.md --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index 9ae8d9d1..18c7abe4 100644 --- a/changelog.md +++ b/changelog.md @@ -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.