Skip to content

Commit

Permalink
Merge pull request #66 from photonle/hotfix/dtvars
Browse files Browse the repository at this point in the history
DT Var Hotfix
  • Loading branch information
JoshPiper authored Nov 8, 2019
2 parents a7e24ae + 9c473e5 commit 1c7b74d
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 87 deletions.
26 changes: 13 additions & 13 deletions lua/autorun/photon/cl_emv_meta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ function EMVU:MakeEMV( emv, name )

function emv:Photon_Lights()
if not IsValid( self ) then return false end
return self:GetDTBool( EMV_LIGHTS_ON )
return self:GetNW2Bool("PhotonLE.EMV_LIGHTS_ON", false)
end

function emv:Photon_LightOption()
if not IsValid( self ) then return 1 end
return self:GetDTInt( EMV_LIGHT_OPTION )
return self:GetNW2Int( "PhotonLE.EMV_LIGHT_OPTION", 1 )
end

function emv:Photon_LightOptionID()
Expand All @@ -67,27 +67,27 @@ function EMVU:MakeEMV( emv, name )

function emv:Photon_Siren()
if not IsValid( self ) then return false end
return self:GetDTBool( EMV_SIREN_ON )
return self:GetNW2Bool( "PhotonLE.EMV_SIREN_ON" )
end

function emv:Photon_SirenOption()
if not IsValid( self ) then return 1 end
return self:GetDTInt( EMV_SIREN_OPTION )
return self:GetNW2Int( "PhotonLE.EMV_SIREN_OPTION" )
end

function emv:Photon_AuxSirenSet()
if not IsValid( self ) then return end
return self:GetDTInt(EMV_SIREN_SECONDARY)
return self:GetNW2Int("PhotonLE.EMV_SIREN_SECONDARY")
end

function emv:Photon_SirenSet()
if not IsValid( self ) then return 1 end
return self:GetDTInt( EMV_SIREN_SET )
return self:GetNW2Int("PhotonLE.EMV_SIREN_SET")
end

function emv:Photon_ManualSiren()
if not IsValid( self ) then return false end
return self:GetDTBool( CAR_MANUAL )
return self:GetNW2Bool( "PhotonLE.CAR_MANUAL" )
end

function emv:Photon_AlertMode()
Expand All @@ -96,7 +96,7 @@ function EMVU:MakeEMV( emv, name )

function emv:Photon_ManualHorn()
if not IsValid( self ) then return false end
return self:GetDTBool( EMV_HORN )
return self:GetNW2Bool( "PhotonLE.EMV_HORN" )
end

function emv:Photon_NoSiren()
Expand All @@ -106,12 +106,12 @@ function EMVU:MakeEMV( emv, name )

function emv:Photon_Illumination()
if not IsValid( self ) then return false end
return self:GetDTBool( EMV_ILLUM_ON )
return self:GetNW2Bool( "PhotonLE.EMV_ILLUM_ON" )
end

function emv:Photon_IllumOption()
if not IsValid( self ) then return 1 end
return self:GetDTInt( EMV_ILLUM_OPTION )
return self:GetNW2Int( "PhotonLE.EMV_ILLUM_OPTION" )
end

function emv:Photon_IllumLights()
Expand All @@ -135,7 +135,7 @@ function EMVU:MakeEMV( emv, name )

function emv:Photon_TrafficAdvisor()
if not IsValid( self ) then return false end
return self:GetDTBool( EMV_TRF_ON )
return self:GetNW2Bool( "PhotonLE.EMV_TRF_ON" )
end

function emv:Photon_AuxLights()
Expand All @@ -144,7 +144,7 @@ function EMVU:MakeEMV( emv, name )

function emv:Photon_TrafficAdvisorOption()
if not IsValid( self ) then return 1 end
return self:GetDTInt( EMV_TRF_OPTION )
return self:GetNW2Int( "PhotonLE.EMV_TRF_OPTION" )
end

function emv:Photon_HasTrafficAdvisor()
Expand All @@ -154,7 +154,7 @@ function EMVU:MakeEMV( emv, name )

function emv:Photon_ELPresetOption()
if not IsValid( self ) then return 0 end
return self:GetDTInt( EMV_PRE_OPTION )
return self:GetNW2Int( "PhotonLE.EMV_PRE_OPTION" )
end

function emv:Photon_PresetEnabled()
Expand Down
22 changes: 21 additions & 1 deletion lua/autorun/photon/cl_photon_hud.lua
Original file line number Diff line number Diff line change
Expand Up @@ -712,5 +712,25 @@ Photon.AddCustomHUDIcon("volume-mute", "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABz
-- end

-- hook.Add( "PostDrawTranslucentRenderables", "photoasndflaskdf", function()
//PhotonTestDraw()
--PhotonTestDraw()
-- end)

--- TODO: REMOVE (DEV FUNCTION ONLY) FOR GRAND LAKE TESTING
-- print("PHOTON UPDATED")
function photonDebugInfo()
print("PHOTON DEBUG INFO FUNCTION ==============")
local veh = LocalPlayer():GetVehicle()
if not IsValid(veh) then
print("> Invalid Vehicle")
return
end
print("> Name: " .. tostring(veh.VehicleName))
if not veh:Photon() then print("> Photon(): false") end
if not veh:IsEMV() then print("> IsEMV(): false") end
timer.Simple(0.5, function()
photonDebugInfo()
end)
end
-- timer.Create("PhotonDebugUpdate", 0.5, 0, function()
-- photonDebugInfo()
-- end)
12 changes: 6 additions & 6 deletions lua/autorun/photon/cl_photon_meta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ function Photon:SetupCar( ent, index )

function ent:Photon_HeadlightsOn()
if not IsValid( self ) then return false end
return self:GetDTBool( CAR_HEADLIGHTS )
return self:GetNW2Bool( "PhotonLE.CAR_HEADLIGHTS" )
end

function ent:Photon_IsBraking()
if not IsValid( self ) then return false end
return self:GetDTBool( CAR_BRAKING )
return self:GetNW2Bool( "PhotonLE.CAR_BRAKING" )
end

function ent:Photon_IsReversing()
if not IsValid( self ) then return false end
return self:GetDTBool( CAR_REVERSING )
return self:GetNW2Bool( "PhotonLE.CAR_REVERSING" )
end

function ent:Photon_IsRunning()
if not IsValid( self ) then return false end
return self:GetDTBool( CAR_RUNNING )
return self:GetNW2Bool( "PhotonLE.CAR_RUNNING" )
end

function ent:Photon_BlinkState()
if not IsValid( self ) then return 0 end
return self:GetDTInt( CAR_BLINKER )
return self:GetNW2Int( "PhotonLE.CAR_BLINKER" )
end

function ent:Photon_TurningLeft()
Expand All @@ -50,7 +50,7 @@ function Photon:SetupCar( ent, index )

function ent:Photon_WheelOption()
if not IsValid( self ) then return 1 end
return self:GetDTInt( CAR_WHEEL_OPTION )
return self:GetNW2Int( "PhotonLE.CAR_WHEEL_OPTION" )
end

function ent:Photon_WheelEnabled()
Expand Down
6 changes: 3 additions & 3 deletions lua/autorun/photon/sh_emv_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ PHOTON_BANNED_UNIT_IDS = {
["n1g"] = true
}

PHOTON_UPDATE = 72.2
PHOTON_SERIES = "Fair Oaks | Siren Hotfix"
PHOTON_UPDATE = 72.3
PHOTON_SERIES = "Fair Oaks | November Garry's Mod Update Hotfix"

--[[
DATATABLE CONFIGURATIONS
If you're a developer or server owner, change these as needed to avoid datatable conflicts.
]]--

-- Booleans
local BOOL_CONST_OFFSET = 19
local BOOL_CONST_OFFSET = 10

EMV_LIGHTS_ON = BOOL_CONST_OFFSET + 0
EMV_SIREN_ON = BOOL_CONST_OFFSET + 1
Expand Down
20 changes: 10 additions & 10 deletions lua/autorun/photon/sh_emv_meta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ local istable = istable
function ent:IsEMV()
if not IsValid( self ) then return false end
if not EMV_INDEX then return false end
local str = self:GetDTString( EMV_INDEX )
local str = self:GetNW2String( "PhotonLE.EMV_INDEX" )
if string.StartWith( tostring(str), "ö" ) then return true end
return false
end

function ent:Photon()
-- return self:GetNWString( "PhotonVehicle", false )
return ( IsValid( self ) and self:IsVehicle() and self:GetDTBool( CAR_HAS_PHOTON ) ) or false
return ( IsValid( self ) and self:IsVehicle() and self:GetNW2Bool( "PhotonLE.CAR_HAS_PHOTON" ) ) or false
end

function ent:HasPhotonELS()
if not IsValid( self ) then return false end
if not EMV_INDEX then return false end
if not self:IsEMV() then return false end
if not self:GetDTBool( CAR_USE_EL ) then return false end
if not self:GetNW2Bool( "PhotonLE.CAR_USE_EL" ) then return false end
return true
end

function ent:EMVName()
if not IsValid( self ) then return "" end
if not EMV_INDEX then return "" end
if self:IsEMV() then
return string.Explode( "ö", self:GetDTString( EMV_INDEX ), false )[2]
return string.Explode( "ö", self:GetNW2String( "PhotonLE.EMV_INDEX" ), false )[2]
end
return ""
end
Expand All @@ -47,11 +47,11 @@ function ent:Photon_AdjustedSpeed()
end

function ent:Photon_GetUnitNumber()
return string.Explode( "ö", self:GetDTString( EMV_INDEX ), false )[3] or ""
return string.Explode( "ö", self:GetNW2String( "PhotonLE.EMV_INDEX" ), false )[3] or ""
end

function ent:Photon_GetLiveryID()
return string.Explode( "ö", self:GetDTString( EMV_INDEX ), false )[4] or ""
return string.Explode( "ö", self:GetNW2String( "PhotonLE.EMV_INDEX" ), false )[4] or ""
end

function ent:Photon_GetAutoSkinIndex()
Expand All @@ -77,12 +77,12 @@ function ent:SetSkin( index )
end

function ent:Photon_SelectionString()
return string.Explode( "ö", self:GetDTString( EMV_INDEX ), false )[5]
return string.Explode( "ö", self:GetNW2String( "PhotonLE.EMV_INDEX" ), false )[5]
end

function ent:Photon_SelectionTable()
-- print(tostring(self:GetDTString( EMV_INDEX )))
local selectionString = string.Explode( "ö", self:GetDTString( EMV_INDEX ), false )[5]
-- print(tostring(self:GetNW2String( EMV_INDEX )))
local selectionString = string.Explode( "ö", self:GetNW2String( "PhotonLE.EMV_INDEX" ), false )[5]
-- print(tostring(selectionString))
return string.Explode( ".", selectionString, false )
end
Expand Down Expand Up @@ -189,7 +189,7 @@ function ent:Photon_ImportSelectionData( inputData )
end

function ent:Photon_GetUtilStringTable()
return string.Explode( "ö", self:GetDTString( EMV_INDEX ), false )
return string.Explode( "ö", self:GetNW2String( "PhotonLE.EMV_INDEX" ), false )
end

function ent:Photon_SelectionEnabled()
Expand Down
Loading

0 comments on commit 1c7b74d

Please sign in to comment.