mirror of
https://github.com/wiremod/wire.git
synced 2025-03-04 03:03:04 -05:00
Add Vehicle Inputs To Cam Controllers And EGP Huds (#3263)
* Add Vehicle Inputs To Cam Controllers And EGP Huds Adds a "Vehicle" input to Cam Controllers and EGP Huds, inline with Pod Controllers. I understand this is somewhat redundant for Cam Controllers but I feel it's relevant. I am working on some addon stuff where a seat may not exist on spawn (generated by another entity). In this case, wire I/O is a reliable way to persist linkages through dupes. * Add 'Vehichles' Input To Pod Controller And EGP Instead of adding 'Vehichle' to Cam Controllers and EGP * Update gmod_wire_pod.lua * Fix Redundant check removed.
This commit is contained in:
parent
f5e78e1400
commit
ee170bb1b9
@ -25,7 +25,8 @@ function ENT:Initialize()
|
|||||||
self:AddEFlags( EFL_FORCE_CHECK_TRANSMIT )
|
self:AddEFlags( EFL_FORCE_CHECK_TRANSMIT )
|
||||||
|
|
||||||
WireLib.CreateInputs(self, {
|
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.)"
|
"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.)",
|
||||||
|
"Vehicles (Links all vehicles of passed array to this egp HUD) [ARRAY]",
|
||||||
})
|
})
|
||||||
|
|
||||||
WireLib.CreateOutputs(self, { "wirelink [WIRELINK]" })
|
WireLib.CreateOutputs(self, { "wirelink [WIRELINK]" })
|
||||||
@ -42,6 +43,12 @@ end
|
|||||||
function ENT:TriggerInput( name, value )
|
function ENT:TriggerInput( name, value )
|
||||||
if (name == "0 to 512") then
|
if (name == "0 to 512") then
|
||||||
self:SetResolution(value ~= 0)
|
self:SetResolution(value ~= 0)
|
||||||
|
elseif name == "Vehicles" then
|
||||||
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -163,7 +163,8 @@ function ENT:Initialize()
|
|||||||
"Disable", "Crosshairs", "Brake", "Allow Buttons",
|
"Disable", "Crosshairs", "Brake", "Allow Buttons",
|
||||||
"Relative (If this is non-zero, the 'Bearing' and 'Elevation' outputs will be relative to the vehicle.)",
|
"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",
|
"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)
|
self.Inputs = WireLib.CreateInputs(self, inputs)
|
||||||
@ -466,11 +467,16 @@ function ENT:TriggerInput(name, value)
|
|||||||
elseif name == "Show Cursor" then
|
elseif name == "Show Cursor" then
|
||||||
self:SetShowCursor(value)
|
self:SetShowCursor(value)
|
||||||
elseif name == "Vehicle" then
|
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( TypeID(value) ~= TYPE_ENTITY ) then return end
|
||||||
if value:IsPlayer() then return end
|
if( not IsValid(value) ) then return end
|
||||||
if value:IsNPC() then return end
|
|
||||||
|
|
||||||
self:LinkEnt(value)
|
self:LinkEnt(value)
|
||||||
|
elseif name == "Vehicles" then
|
||||||
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user