Skip to content

Commit

Permalink
Fix storing outputs not meant to be transitioned
Browse files Browse the repository at this point in the history
  • Loading branch information
ZehMatt committed Jun 4, 2024
1 parent cd1f3df commit c3907a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion gamemode/sh_vehicles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ if SERVER then
end

-- Akward hack to know if an NPC passenger is inside. We handle this with our AcceptInput hook.
self.IsCreatingInternalOutputs = true
vehicle:Input("AddOutput", NULL, NULL, "OnCompanionEnteredVehicle !self,LambdaCompanionEnteredVehicle,,0,-1")
vehicle:Input("AddOutput", NULL, NULL, "OnCompanionExitedVehicle !self,LambdaCompanionExitedVehicle,,1,-1")

self.IsCreatingInternalOutputs = false

-- We only get a model next frame, delay it.
util.RunNextFrame(function()
if not IsValid(vehicle) then return end
Expand Down
4 changes: 2 additions & 2 deletions gamemode/sv_inputoutput.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ function GM:AcceptInput(ent, inputName, activator, caller, value)
end

-- Deal with AddOutput.
if inputName == "AddOutput" then
if inputName == "AddOutput" and self.IsCreatingInternalOutputs ~= true then
-- Split outputname and output parameters.
local outputName, outputParams = string.match(value, "(%w+)%s+(.*)")

-- AddOutput uses double point instead of comma, replace that.
outputParams = string.gsub(outputParams, ":", ",")

print(ent, "AddOutput", outputName, outputParams)
DbgPrint("Handling AddOutput", ent, outputName, outputParams)

ent.EntityOutputs = ent.EntityOutputs or {}
local outputs = ent.EntityOutputs[outputName] or {}
Expand Down

0 comments on commit c3907a5

Please sign in to comment.