Skip to content

Commit

Permalink
Add 'Vehichles' Input To Pod Controller And EGP
Browse files Browse the repository at this point in the history
Instead of adding 'Vehichle' to Cam Controllers and EGP
  • Loading branch information
LengthenedGradient committed Feb 12, 2025
1 parent 38de134 commit fa30bf4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
7 changes: 0 additions & 7 deletions lua/entities/gmod_wire_cameracontroller.lua
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,6 @@ function ENT:Initialize()
"FLIR",
"FOV",
"Vehicles (Links all vehicles of passed array to this cam controller) [ARRAY]",
"Vehicle [ENTITY]"
})

self.Activated = false -- Whether or not to activate the cam controller for all players sitting in linked vehicles, or as soon as a player sits in a linked vehicle
Expand Down Expand Up @@ -865,12 +864,6 @@ function ENT:TriggerInput( name, value )
if( not IsValid(v) ) then continue end
self:LinkEnt( v )
end
elseif name == "Vehicle" then
if not IsValid(value) then return end -- Only link if the input is valid. That way, it won't be unlinked if the wire is disconnected
if value:IsPlayer() then return end
if value:IsNPC() then return end

self:LinkEnt(value)
else
self:LocalizePositions(false)

Expand Down
15 changes: 8 additions & 7 deletions lua/entities/gmod_wire_egp_hud/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function ENT:Initialize()

WireLib.CreateInputs(self, {
"0 to 512 (If enabled, changes the resolution of the egp hud to be between 0 and 512 instead of the user's monitor's resolution.\nWill cause objects to look stretched out on most screens, so your UI will need to be designed with this in mind.\nIt's recommended to use the egpScrW, egpScrH, and egpScrSize functions instead.)",
"Vehicle [ENTITY]"
"Vehicles (Links all vehicles of passed array to this egp HUD) [ARRAY]",
})

WireLib.CreateOutputs(self, { "wirelink [WIRELINK]" })
Expand All @@ -43,12 +43,13 @@ end
function ENT:TriggerInput( name, value )
if (name == "0 to 512") then
self:SetResolution(value ~= 0)
elseif name == "Vehicle" then
if not IsValid(value) then return end -- Only link if the input is valid. That way, it won't be unlinked if the wire is disconnected
if value:IsPlayer() then return end
if value:IsNPC() then return end

self:LinkEnt(value)
elseif name == "Vehicles" then
self:ClearEntities()
for k, v in ipairs( value ) do
if( TypeID(v) ~= TYPE_ENTITY ) then continue end
if( not IsValid(v) ) then continue end
self:LinkEnt( v )
end
end
end

Expand Down
10 changes: 9 additions & 1 deletion lua/entities/gmod_wire_pod.lua
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ function ENT:Initialize()
"Disable", "Crosshairs", "Brake", "Allow Buttons",
"Relative (If this is non-zero, the 'Bearing' and 'Elevation' outputs will be relative to the vehicle.)",
"Damage Health (Damages the driver's health.)", "Damage Armor (Damages the driver's armor.)", "Hide Player", "Hide HUD", "Show Cursor",
"Vehicle [ENTITY]"
"Vehicle [ENTITY]",
"Vehicles (Links all vehicles of passed array to this pod controller) [ARRAY]",
}

self.Inputs = WireLib.CreateInputs(self, inputs)
Expand Down Expand Up @@ -471,6 +472,13 @@ function ENT:TriggerInput(name, value)
if value:IsNPC() then return end

self:LinkEnt(value)
elseif name == "Vehicles" then
self:ClearEntities()
for k, v in ipairs( value ) do
if( TypeID(v) ~= TYPE_ENTITY ) then continue end
if( not IsValid(v) ) then continue end
self:LinkEnt( v )
end
end
end

Expand Down

0 comments on commit fa30bf4

Please sign in to comment.