ACF Custom Mod V3 - 9.21
--Added Custom Mod Tips Menu --Added Turbocharger --Added Supercharger --Added Turbo/supercharger to sound tool --Fixed Custom to Engine Maker Updating --Help Menu Cleaned
This commit is contained in:
parent
b478a733af
commit
5b303a3108
|
@ -68,3 +68,21 @@ You can update Original engines
|
|||
to become Custom engines in 1clic.
|
||||
Work with gearboxes, engine maker, etc.
|
||||
You should wire and link it again.
|
||||
|
||||
*r105
|
||||
-9.21 V3
|
||||
--Added Custom Mod Tips Menu
|
||||
--Added Turbocharger
|
||||
--Added Supercharger
|
||||
--Added Turbo/supercharger to sound tool
|
||||
|
||||
--Fixed Custom to Engine Maker Updating
|
||||
|
||||
--Help Menu Cleaned
|
||||
|
||||
----SPECIALS NOTES----
|
||||
**Thanks to SEM for models**
|
||||
Turbo and Supercharger are in test
|
||||
They are working fine, but might be
|
||||
improved in furtur update. I'm gonna
|
||||
check the feedback of them
|
|
@ -85,7 +85,7 @@ function PANEL:Init( )
|
|||
NodeAdd = CustomGB
|
||||
elseif( MobilityTable.ent == "acf_enginemaker") then
|
||||
if Makerlimit > 0 then NodeAdd = MakerNode end
|
||||
elseif ( MobilityTable.ent == "acf_chips" or MobilityTable.ent == "acf_nos" or MobilityTable.ent == "acf_rads") then
|
||||
elseif ( MobilityTable.ent == "acf_turbo" or MobilityTable.ent == "acf_supercharger" or MobilityTable.ent == "acf_chips" or MobilityTable.ent == "acf_nos" or MobilityTable.ent == "acf_rads") then
|
||||
if Extralimit > 0 then NodeAdd = ExtraNode end
|
||||
end
|
||||
if(MobilityTable.category) then
|
||||
|
@ -115,7 +115,7 @@ function PANEL:Init( )
|
|||
NodeAdd = EngineSubcats[MobilityTable.category]
|
||||
end
|
||||
end
|
||||
elseif MobilityTable.ent == "acf_chips" or MobilityTable.ent == "acf_nos" or MobilityTable.ent == "acf_rads" then
|
||||
elseif MobilityTable.ent == "acf_turbo" or MobilityTable.ent == "acf_supercharger" or MobilityTable.ent == "acf_chips" or MobilityTable.ent == "acf_nos" or MobilityTable.ent == "acf_rads" then
|
||||
if Extralimit > 0 then
|
||||
NodeAdd = ExtraNode
|
||||
if(MobilityTable.category) then
|
||||
|
@ -254,6 +254,17 @@ function ACFHomeCustomGUICreate( Table )
|
|||
end
|
||||
acfmenupanelcustom.CustomDisplay:AddItem( HelpText1 )
|
||||
|
||||
WhatCustom = vgui.Create( "DButton" )
|
||||
WhatCustom:SetText("Custom Mod Tips")
|
||||
WhatCustom:SetTextColor(Color(Redcolor,Greencolor,Bluecolor,255))
|
||||
WhatCustom:SetToolTip("Clic here to get Help about ACF\nAbout Wiring, Linking, Options, Installation")
|
||||
WhatCustom:SetWide(80)
|
||||
WhatCustom:SetTall(30)
|
||||
WhatCustom.DoClick = function()
|
||||
RunConsoleCommand("acf_customcando_open")
|
||||
end
|
||||
acfmenupanelcustom.CustomDisplay:AddItem( WhatCustom )
|
||||
|
||||
TextLog= vgui.Create( "DLabel" )
|
||||
TextLog:SetText( "Changelog")
|
||||
TextLog:SetTextColor(Color(0,0,50,255))
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
// Made by Bouletmarc.
|
||||
|
||||
local StartBrowserPanel = nil
|
||||
|
||||
local Changelog = {}
|
||||
|
||||
local function CreateSoundBrowser()
|
||||
|
||||
StartBrowserPanel = vgui.Create("DFrame") // The main frame.
|
||||
StartBrowserPanel:SetSize(700, 450)
|
||||
--Set Center
|
||||
StartBrowserPanel:SetPos(((ScrW()/2)-(StartBrowserPanel:GetWide()/2))+ScrW()/4,(ScrH()/2)-(StartBrowserPanel:GetTall()/2))
|
||||
|
||||
StartBrowserPanel:SetMinWidth(700)
|
||||
StartBrowserPanel:SetMinHeight(450)
|
||||
|
||||
StartBrowserPanel:SetSizable(false)
|
||||
StartBrowserPanel:SetDeleteOnClose( true )
|
||||
StartBrowserPanel:SetTitle("Custom Mod Tips Menu V9.2")
|
||||
StartBrowserPanel:SetVisible(false)
|
||||
StartBrowserPanel:SetCookieName( "wire_sound_browser" )
|
||||
StartBrowserPanel:GetParent():SetWorldClicker(true) // Allow the use of the toolgun while in menu.
|
||||
|
||||
local ButtonsSidePanel = StartBrowserPanel:Add("DPanel")
|
||||
ButtonsSidePanel:DockMargin(4, 4, 4, 4)
|
||||
ButtonsSidePanel:Dock(TOP)
|
||||
ButtonsSidePanel:SetSize(330, 406)
|
||||
ButtonsSidePanel:SetDrawBackground(true)
|
||||
--#############################################################
|
||||
--loading
|
||||
local Redcolor = 0
|
||||
local Greencolor = 0
|
||||
local Bluecolor = 0
|
||||
if file.Exists("acf/menucolor.txt", "DATA") then
|
||||
local MenuColor = file.Read("acf/menucolor.txt")
|
||||
local MenuColorTable = {}
|
||||
for w in string.gmatch(MenuColor, "([^,]+)") do
|
||||
table.insert(MenuColorTable, w)
|
||||
end
|
||||
Redcolor = tonumber(MenuColorTable[1])
|
||||
Greencolor = tonumber(MenuColorTable[2])
|
||||
Bluecolor = tonumber(MenuColorTable[3])
|
||||
else
|
||||
Redcolor = 0
|
||||
Greencolor = 0
|
||||
Bluecolor = 200
|
||||
RunConsoleCommand( "acfcustom_red", Redcolor )
|
||||
RunConsoleCommand( "acfcustom_green", Greencolor )
|
||||
RunConsoleCommand( "acfcustom_blue", Bluecolor )
|
||||
SaveFunc()
|
||||
end
|
||||
--###########################################
|
||||
local CustomCanDoClient = ""
|
||||
local CustomCanDoServer = ""
|
||||
CustomCanDoClient = CustomCanDoClient .. " CLIENT :\n"
|
||||
CustomCanDoClient = CustomCanDoClient .. "-Engines have a rev limiter(cutoff) sound, can be disabled by wiring DisableCut to a Value that equal 1\n"
|
||||
CustomCanDoClient = CustomCanDoClient .. "-Turbine and Eletric engine will not have rev limiter(cut off), its useles for thoses engines\n"
|
||||
CustomCanDoClient = CustomCanDoClient .. "-ANY engines not require fuel, to require fuel link a fuel tank (add 25% torque, but the weight come with it)\n"
|
||||
CustomCanDoClient = CustomCanDoClient .. "-When you stop a engine, it'll stop progressively\n"
|
||||
CustomCanDoClient = CustomCanDoClient .. "-Engines link to the Chips, Nos, Turbo, Supercharger or Radiators\n"
|
||||
CustomCanDoClient = CustomCanDoClient .. "-To update the engines made from Engine Maker, select Engine Maker again in the menu, it'll update values\n"
|
||||
CustomCanDoClient = CustomCanDoClient .. "-It having all E2 functions like 'acfCustomThrottle(100)', also having customs functions like 'acfCustomTqAdd(50)'\n"
|
||||
CustomCanDoClient = CustomCanDoClient .. "-Custom Mod have more sounds, more engines, and also old models back\n"
|
||||
CustomCanDoClient = CustomCanDoClient .. "-The CVT from the custom mod are the first acf CVT ever made, and probably better than the original\n"
|
||||
CustomCanDoClient = CustomCanDoClient .. "-The Airplane Beta Gearbox are used to rotate and also push/pull a prop like a propeller\n"
|
||||
CustomCanDoServer = CustomCanDoServer .. " SERVER :\n"
|
||||
CustomCanDoServer = CustomCanDoServer .. "-sbox_max_acf_modding (0-1) allow engines modding (wire inputs)\n"
|
||||
CustomCanDoServer = CustomCanDoServer .. "-sbox_max_acf_extra (Value) the number of acf extras allowed (chips,nos)\n"
|
||||
CustomCanDoServer = CustomCanDoServer .. "-sbox_max_acf_maker (Value) the number of engines from engines maker allowed\n"
|
||||
CustomCanDoServer = CustomCanDoServer .. "-Anyone can use it if its on the server, and the client only get acf orignal\n"
|
||||
|
||||
CurrentText = ButtonsSidePanel:Add("DLabel")
|
||||
CurrentText:SetPos(120,20)
|
||||
CurrentText:SetFont( "DefaultBold" )
|
||||
CurrentText:SetText("Custom Mod Tips : ")
|
||||
CurrentText:SetTextColor(Color(Redcolor,Greencolor,Bluecolor,255))
|
||||
CurrentText:SizeToContents()
|
||||
|
||||
CustomModTipsClient = ButtonsSidePanel:Add("DLabel")
|
||||
CustomModTipsClient:SetText(CustomCanDoClient)
|
||||
CustomModTipsClient:SetTextColor(Color(Redcolor,Greencolor,Bluecolor,255))
|
||||
CustomModTipsClient:SetPos(20,60)
|
||||
CustomModTipsClient:SetFont( "DefaultBold" )
|
||||
CustomModTipsClient:SizeToContents()
|
||||
|
||||
CustomModTipsServer = ButtonsSidePanel:Add("DLabel")
|
||||
CustomModTipsServer:SetText(CustomCanDoServer)
|
||||
CustomModTipsServer:SetTextColor(Color(Redcolor,Greencolor,Bluecolor,255))
|
||||
CustomModTipsServer:SetPos(20,230)
|
||||
CustomModTipsServer:SetFont( "DefaultBold" )
|
||||
CustomModTipsServer:SizeToContents()
|
||||
|
||||
Close = ButtonsSidePanel:Add("DButton")
|
||||
Close:SetText("Close")
|
||||
Close:SetTextColor(Color(Redcolor,Greencolor,Bluecolor,255))
|
||||
Close:SetPos( 220,340 )
|
||||
Close:SetWide(80)
|
||||
Close:SetTall( 50 )
|
||||
Close.DoClick = function()
|
||||
StartBrowserPanel:Close()
|
||||
end
|
||||
|
||||
|
||||
StartBrowserPanel.OnClose = function() end
|
||||
|
||||
StartBrowserPanel:InvalidateLayout(false)
|
||||
|
||||
end
|
||||
|
||||
local function OpenSartBrowser(pl, cmd, args)
|
||||
if (!IsValid(StartBrowserPanel)) then
|
||||
CreateSoundBrowser()
|
||||
end
|
||||
StartBrowserPanel:SetVisible(true)
|
||||
StartBrowserPanel:MakePopup()
|
||||
StartBrowserPanel:InvalidateLayout(true)
|
||||
|
||||
WireLib.Timedcall(function(StartBrowserPanel)
|
||||
if (!IsValid(StartBrowserPanel)) then return end
|
||||
StartBrowserPanel:InvalidateLayout(true)
|
||||
end, StartBrowserPanel)
|
||||
end
|
||||
|
||||
concommand.Add("acf_customcando_open", OpenSartBrowser)
|
|
@ -102,8 +102,6 @@ local function CreateSoundBrowser()
|
|||
WireLineEngine = WireLineEngine .. "- Idle to a Idle RPM Value\n"
|
||||
WireLineEngine = WireLineEngine .. "- Disable Cutoff to 1 to Disable the Cutoff\n"
|
||||
WireLineEngine = WireLineEngine .. "- Override to a Override RPM Value\n"
|
||||
WireLineEngine = WireLineEngine .. "- Gearbox RPM to Gearbox ONLY if you don't want\n"
|
||||
WireLineEngine = WireLineEngine .. "* your engine to use the autoclutch system\n"
|
||||
|
||||
local WireLineGearbox = ""
|
||||
WireLineGearbox = WireLineGearbox .. "- Clutch should be wired to (0-1)\n"
|
||||
|
|
|
@ -116,8 +116,7 @@ local function CreateSoundBrowser()
|
|||
LinkingLine1 = LinkingLine1 .. "- Engine must be linked to Gearbox, FuelTank or a Engine Extra\n"
|
||||
LinkingLine1 = LinkingLine1 .. "- Gearbox's must be linked to Wheels (regular prop's)\n"
|
||||
LinkingLine1 = LinkingLine1 .. "- Gun must be linked to the Ammo Box\n\n"
|
||||
LinkingLine1 = LinkingLine1 .. "-- Chips is a Engine Extra\n"
|
||||
LinkingLine1 = LinkingLine1 .. "-- Nos is a Engine Extra\n"
|
||||
LinkingLine1 = LinkingLine1 .. "-- Chips, Nos, Turbo, Supercharger and Radiator is a Engine Extra\n"
|
||||
|
||||
--local EngineLineOption = ""
|
||||
--#########################################################################################
|
||||
|
|
|
@ -49,6 +49,16 @@ local rads_base = {
|
|||
ent = "acf_rads",
|
||||
type = "MobilityCustom"
|
||||
}
|
||||
--turbo
|
||||
local turbo_base = {
|
||||
ent = "acf_turbo",
|
||||
type = "MobilityCustom"
|
||||
}
|
||||
--supercharger
|
||||
local supercharger_base = {
|
||||
ent = "acf_supercharger",
|
||||
type = "MobilityCustom"
|
||||
}
|
||||
|
||||
--##############################
|
||||
--## set gui ####
|
||||
|
@ -77,6 +87,12 @@ if CLIENT then
|
|||
--radiator
|
||||
rads_base.guicreate = function( panel, tbl ) ACFRadsGUICreate( tbl ) end or nil
|
||||
rads_base.guiupdate = function() return end
|
||||
--turbo
|
||||
turbo_base.guicreate = function( panel, tbl ) ACFTurboGUICreate( tbl ) end or nil
|
||||
turbo_base.guiupdate = function() return end
|
||||
--supercharger
|
||||
supercharger_base.guicreate = function( panel, tbl ) ACFSuperchargerGUICreate( tbl ) end or nil
|
||||
supercharger_base.guiupdate = function() return end
|
||||
end
|
||||
|
||||
--##############################
|
||||
|
@ -129,6 +145,18 @@ function ACF_DefineRads( id, data )
|
|||
table.Inherit( data, rads_base )
|
||||
MobilityTable[ id ] = data
|
||||
end
|
||||
--turbo
|
||||
function ACF_DefineTurbo( id, data )
|
||||
data.id = id
|
||||
table.Inherit( data, turbo_base )
|
||||
MobilityTable[ id ] = data
|
||||
end
|
||||
--supercharger
|
||||
function ACF_DefineSupercharger( id, data )
|
||||
data.id = id
|
||||
table.Inherit( data, supercharger_base )
|
||||
MobilityTable[ id ] = data
|
||||
end
|
||||
|
||||
--##############################
|
||||
--## search and load ####
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
--ENGINE SUPERCHARGER
|
||||
|
||||
ACF_DefineSupercharger( "V1_Supercharger", {
|
||||
name = "Engine Supercharger",
|
||||
desc = "The Supercharger is used to add power/rpm to the engine same as a real Supercharger",
|
||||
model = "models/sem/chargers/sem_supercharger.mdl",
|
||||
sound = "acf_extra/vehiclefx/boost/supercharger.wav",
|
||||
modtable = {
|
||||
[1] = 0.5 --Supercharger Torque/hp Slider
|
||||
}
|
||||
} )
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
--ENGINE TURBO
|
||||
|
||||
ACF_DefineTurbo( "V1_Turbo", {
|
||||
name = "Engine Turbocharger",
|
||||
desc = "The Turbocharger is used to add power/rpm to the engine same as a real Turbocharger",
|
||||
model = "models/sem/chargers/sem_turbocharger.mdl",
|
||||
sound = "/acf_extra/vehiclefx/boost/tcl_turbo.wav",
|
||||
modtable = {
|
||||
[1] = 0.5, --Turbo Torque/hp Slider
|
||||
[2] = "acf_extra/vehiclefx/boost/evo8_blowoff.wav" --BOV
|
||||
}
|
||||
} )
|
|
@ -1,7 +1,7 @@
|
|||
ACFCUSTOM = {}
|
||||
--##############
|
||||
ACFCUSTOM.VersionCustom = 9.11
|
||||
ACFCUSTOM.Version2 = 104
|
||||
ACFCUSTOM.VersionCustom = 9.21
|
||||
ACFCUSTOM.Version2 = 105
|
||||
ACFCUSTOM.CurrentVersion2 = 0
|
||||
print("[[ ACF Custom Loaded ]]")
|
||||
|
||||
|
|
|
@ -831,7 +831,8 @@ function ENT:CalcRPM()
|
|||
if IsValid( Extra ) then
|
||||
if Extra.GetRpm == true then
|
||||
if not Extra.Legal then continue end
|
||||
Extra:GetRPM(self.FlyRPM)
|
||||
local PeakTorqueSend = (self.PeakTorqueAdd-self.PeakTorqueHealth)*self.TorqueMult
|
||||
Extra:GetRPM(self.FlyRPM, self.LimitRPM, self.Weight, self.Throttle, self.EngineType, PeakTorqueSend, self.IdleRPM)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -905,7 +906,7 @@ end
|
|||
|
||||
function ENT:Link( Target )
|
||||
--Allowable Target
|
||||
if not IsValid( Target ) or not table.HasValue( { "acf_gearbox", "acf_gearboxcvt", "acf_gearboxauto", "acf_fueltank", "acf_chips", "acf_nos", "acf_rads" }, Target:GetClass() ) then
|
||||
if not IsValid( Target ) or not table.HasValue( { "acf_gearbox", "acf_gearboxcvt", "acf_gearboxauto", "acf_fueltank", "acf_chips", "acf_nos", "acf_rads", "acf_turbo", "acf_supercharger" }, Target:GetClass() ) then
|
||||
return false, "Can only link to gearboxes, fuel tanks or engine extras!"
|
||||
end
|
||||
--Fuel Tank Linking
|
||||
|
@ -913,8 +914,8 @@ function ENT:Link( Target )
|
|||
return self:LinkFuel( Target )
|
||||
end
|
||||
--Extra Linking
|
||||
if Target:GetClass() == "acf_chips" or Target:GetClass() == "acf_nos" then
|
||||
if self.ExtraUsing == 1 then --Not link severals Extra Obje
|
||||
if Target:GetClass() == "acf_chips" or Target:GetClass() == "acf_nos" or Target:GetClass() == "acf_turbo" or Target:GetClass() == "acf_supercharger" then
|
||||
if self.ExtraUsing == 1 then --Not link severals Extra Object
|
||||
return false, "You CAN'T use more that one Extra!"
|
||||
else
|
||||
return self:LinkExtra( Target )
|
||||
|
@ -966,7 +967,7 @@ function ENT:Unlink( Target )
|
|||
return self:UnlinkFuel( Target )
|
||||
end
|
||||
--unlink extra
|
||||
if Target:GetClass() == "acf_chips" or Target:GetClass() == "acf_nos" then
|
||||
if Target:GetClass() == "acf_chips" or Target:GetClass() == "acf_nos" or Target:GetClass() == "acf_turbo" or Target:GetClass() == "acf_supercharger" then
|
||||
return self:UnlinkExtra( Target )
|
||||
end
|
||||
--unlink radiator
|
||||
|
|
|
@ -1060,7 +1060,8 @@ function ENT:CalcRPM()
|
|||
if IsValid( Extra ) then
|
||||
if Extra.GetRpm == true then
|
||||
if not Extra.Legal then continue end
|
||||
Extra:GetRPM(self.FlyRPM)
|
||||
local PeakTorqueSend = (self.PeakTorqueAdd-self.PeakTorqueHealth)*self.TorqueMult
|
||||
Extra:GetRPM(self.FlyRPM, self.LimitRPM, self.Weight, self.Throttle, self.EngineType, PeakTorqueSend, self.IdleRPM)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1134,7 +1135,7 @@ end
|
|||
|
||||
function ENT:Link( Target )
|
||||
--Allowable Target
|
||||
if not IsValid( Target ) or not table.HasValue( { "acf_gearbox", "acf_gearboxcvt", "acf_gearboxauto", "acf_fueltank", "acf_chips", "acf_nos", "acf_rads" }, Target:GetClass() ) then
|
||||
if not IsValid( Target ) or not table.HasValue( { "acf_gearbox", "acf_gearboxcvt", "acf_gearboxauto", "acf_fueltank", "acf_chips", "acf_nos", "acf_rads", "acf_turbo", "acf_supercharger" }, Target:GetClass() ) then
|
||||
return false, "Can only link to gearboxes, fuel tanks or engine extras!"
|
||||
end
|
||||
--Fuel Tank Linking
|
||||
|
@ -1142,7 +1143,7 @@ function ENT:Link( Target )
|
|||
return self:LinkFuel( Target )
|
||||
end
|
||||
--Extra Linking
|
||||
if Target:GetClass() == "acf_chips" or Target:GetClass() == "acf_nos" then
|
||||
if Target:GetClass() == "acf_chips" or Target:GetClass() == "acf_nos" or Target:GetClass() == "acf_turbo" or Target:GetClass() == "acf_supercharger" then
|
||||
if self.ExtraUsing == 1 then --Not link severals Extra Obje
|
||||
return false, "You CAN'T use more that one Extra!"
|
||||
else
|
||||
|
@ -1195,7 +1196,7 @@ function ENT:Unlink( Target )
|
|||
return self:UnlinkFuel( Target )
|
||||
end
|
||||
--unlink extra
|
||||
if Target:GetClass() == "acf_chips" or Target:GetClass() == "acf_nos" then
|
||||
if Target:GetClass() == "acf_chips" or Target:GetClass() == "acf_nos" or Target:GetClass() == "acf_turbo" or Target:GetClass() == "acf_supercharger" then
|
||||
return self:UnlinkExtra( Target )
|
||||
end
|
||||
--unlink radiator
|
||||
|
|
|
@ -0,0 +1,309 @@
|
|||
AddCSLuaFile()
|
||||
|
||||
DEFINE_BASECLASS( "base_wire_entity" )
|
||||
|
||||
ENT.PrintName = "ACF Supercharger"
|
||||
ENT.WireDebugName = "ACF Supercharger"
|
||||
|
||||
if CLIENT then
|
||||
|
||||
function ACFSuperchargerGUICreate( Table )
|
||||
|
||||
if not acfmenupanelcustom.ModData then
|
||||
acfmenupanelcustom.ModData = {}
|
||||
end
|
||||
if not acfmenupanelcustom.ModData[Table.id] then
|
||||
acfmenupanelcustom.ModData[Table.id] = {}
|
||||
acfmenupanelcustom.ModData[Table.id].ModTable = Table.modtable
|
||||
end
|
||||
|
||||
acfmenupanelcustom:CPanelText("Name", Table.name)
|
||||
|
||||
acfmenupanelcustom.CData.DisplayModel = vgui.Create( "DModelPanel", acfmenupanelcustom.CustomDisplay )
|
||||
acfmenupanelcustom.CData.DisplayModel:SetModel( Table.model )
|
||||
acfmenupanelcustom.CData.DisplayModel:SetCamPos( Vector( 250, 325, 250 ) )
|
||||
acfmenupanelcustom.CData.DisplayModel:SetLookAt( Vector( 0, 0, 0 ) )
|
||||
acfmenupanelcustom.CData.DisplayModel:SetFOV( 3 )
|
||||
acfmenupanelcustom.CData.DisplayModel:SetSize(acfmenupanelcustom:GetWide(),acfmenupanelcustom:GetWide())
|
||||
acfmenupanelcustom.CData.DisplayModel.LayoutEntity = function( panel, entity ) end
|
||||
acfmenupanelcustom.CustomDisplay:AddItem( acfmenupanelcustom.CData.DisplayModel )
|
||||
|
||||
acfmenupanelcustom:CPanelText("Desc", "Desc : "..Table.desc.."\n\n")
|
||||
|
||||
for ID,Value in pairs(acfmenupanelcustom.ModData[Table.id]["ModTable"]) do
|
||||
if ID == 1 then
|
||||
ACF_SuperchargerSlider(1, Value, Table.id)
|
||||
end
|
||||
end
|
||||
|
||||
acfmenupanelcustom.CustomDisplay:PerformLayout()
|
||||
|
||||
end
|
||||
|
||||
function ACF_SuperchargerSlider(Mod, Value, ID)
|
||||
|
||||
acfmenupanelcustom:CPanelText("Pulley", " <---- Smaller // Pulley Size // Bigger ---->")
|
||||
|
||||
if Mod and not acfmenupanelcustom.CData[Mod] then
|
||||
acfmenupanelcustom.CData[Mod] = vgui.Create( "DNumSlider", acfmenupanelcustom.CustomDisplay )
|
||||
acfmenupanelcustom.CData[Mod]:SetWide(100)
|
||||
acfmenupanelcustom.CData[Mod]:SetMin(0.01)
|
||||
acfmenupanelcustom.CData[Mod]:SetMax(1)
|
||||
acfmenupanelcustom.CData[Mod]:SetDecimals(2)
|
||||
acfmenupanelcustom.CData[Mod]["Mod"] = Mod
|
||||
acfmenupanelcustom.CData[Mod]["ID"] = ID
|
||||
acfmenupanelcustom.CData[Mod]:SetValue(Value)
|
||||
acfmenupanelcustom.CData[Mod]:SetDark( true )
|
||||
RunConsoleCommand( "acfcustom_data"..Mod, Value )
|
||||
acfmenupanelcustom.CData[Mod].OnValueChanged = function( slider, val )
|
||||
acfmenupanelcustom.ModData[slider.ID]["ModTable"][slider.Mod] = val
|
||||
RunConsoleCommand( "acfcustom_data"..Mod, val )
|
||||
end
|
||||
acfmenupanelcustom.CustomDisplay:AddItem( acfmenupanelcustom.CData[Mod] )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
--Persist Values
|
||||
self.Boost = 0
|
||||
self.BoostRpmStart = 1
|
||||
self.BoostMax = 1
|
||||
self.TorqueAdd = 0
|
||||
self.TorqueAddMax = 1
|
||||
self.RPMAdd = 1000
|
||||
self.RPM = 0
|
||||
self.LimitRPM = 2
|
||||
|
||||
self.GetRpm = true
|
||||
|
||||
--think
|
||||
self.Master = {}
|
||||
self.CanUpdate = true
|
||||
self.Legal = true
|
||||
self.LastActive = 0
|
||||
self.LegalThink = 0
|
||||
self.SuperchargerThink = 0
|
||||
|
||||
Wire_TriggerOutput(self, "Entity", self)
|
||||
self.WireDebugName = "ACF Supercharger"
|
||||
|
||||
end
|
||||
|
||||
function MakeACF_Supercharger(Owner, Pos, Angle, Id, Data1)
|
||||
|
||||
if not Owner:CheckLimit("_acf_extra") then return false end
|
||||
|
||||
local Supercharger = ents.Create("acf_supercharger")
|
||||
if not IsValid( Supercharger ) then return false end
|
||||
|
||||
local EID
|
||||
local List = list.Get("ACFCUSTOMEnts")
|
||||
if List.MobilityCustom[Id] then EID = Id else EID = "V1_Supercharger" end
|
||||
local Lookup = List.MobilityCustom[EID]
|
||||
|
||||
Supercharger:SetAngles(Angle)
|
||||
Supercharger:SetPos(Pos)
|
||||
Supercharger:Spawn()
|
||||
|
||||
Supercharger:SetPlayer(Owner)
|
||||
Supercharger.Owner = Owner
|
||||
Supercharger.Id = EID
|
||||
Supercharger.Model = Lookup.model
|
||||
Supercharger.SoundPath = Lookup.sound
|
||||
Supercharger.Weight = 30 --this is a basic weight value
|
||||
Supercharger.ModTable = Lookup.modtable
|
||||
Supercharger.ModTable[1] = Data1
|
||||
--Set All Mods
|
||||
Supercharger.Mods1 = Data1 --Slider
|
||||
|
||||
--Supercharger Settings
|
||||
Supercharger.SliderVal = tonumber(Supercharger.Mods1)
|
||||
|
||||
--Creating Wire Outputs
|
||||
local Outputs = {"Boost"}
|
||||
local OutputsTypes = {"NORMAL"}
|
||||
Supercharger.Outputs = WireLib.CreateSpecialOutputs( Supercharger, Outputs, OutputsTypes )
|
||||
|
||||
Supercharger:SetModel( Supercharger.Model )
|
||||
|
||||
Supercharger:PhysicsInit( SOLID_VPHYSICS )
|
||||
Supercharger:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
Supercharger:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
local phys = Supercharger:GetPhysicsObject()
|
||||
if IsValid( phys ) then
|
||||
phys:SetMass( Supercharger.Weight )
|
||||
end
|
||||
|
||||
Owner:AddCount("_acf_supercharger", Supercharger)
|
||||
Owner:AddCleanup( "acfmenu", Supercharger )
|
||||
|
||||
Supercharger:SetNetworkedString( "WireName", Lookup.name )
|
||||
Supercharger:UpdateOverlayText()
|
||||
Supercharger:SetWireOutputs()
|
||||
|
||||
return Supercharger
|
||||
end
|
||||
list.Set( "ACFCvars", "acf_supercharger" , {"id", "data1"} )
|
||||
duplicator.RegisterEntityClass("acf_supercharger", MakeACF_Supercharger, "Pos", "Angle", "Id", "Mods1")
|
||||
|
||||
function ENT:Update( ArgsTable )
|
||||
|
||||
if ArgsTable[1] ~= self.Owner then -- Argtable[1] is the player that shot the tool
|
||||
return false, "You don't own that engine chip!"
|
||||
end
|
||||
|
||||
local Id = ArgsTable[4] -- Argtable[4] is the supercharger ID
|
||||
local Lookup = list.Get("ACFCUSTOMEnts").MobilityCustom[Id]
|
||||
|
||||
if Lookup.model ~= self.Model then
|
||||
return false, "The new Engine Chip must have the same model!"
|
||||
end
|
||||
|
||||
if self.Id != Id then
|
||||
self.Id = Id
|
||||
self.Model = Lookup.model
|
||||
self.SoundPath = Lookup.sound
|
||||
self.Weight = 30 --this is a basic weight value
|
||||
end
|
||||
|
||||
self.ModTable[1] = ArgsTable[5]
|
||||
--Set Mods
|
||||
self.Mods1 = ArgsTable[5] --Slider
|
||||
|
||||
--Supercharger Settings
|
||||
self.SliderVal = tonumber(self.Mods1)
|
||||
|
||||
--Creating Wire Outputs
|
||||
local Outputs = {"Boost"}
|
||||
local OutputsTypes = {"NORMAL"}
|
||||
self.Outputs = WireLib.CreateSpecialOutputs( self, Outputs, OutputsTypes )
|
||||
|
||||
self:SetNetworkedString( "WireName", Lookup.name )
|
||||
self:UpdateOverlayText()
|
||||
self:SetWireOutputs()
|
||||
|
||||
return true, "Supercharger updated successfully!"
|
||||
end
|
||||
--Set the wire Output
|
||||
function ENT:SetWireOutputs()
|
||||
Wire_TriggerOutput(self, "Boost", math.Round(self.Boost,1))
|
||||
end
|
||||
--Set the Overlay Text
|
||||
function ENT:UpdateOverlayText()
|
||||
local text = ""
|
||||
text = text .. "Boost: "..math.Round(self.Boost,1).." Psi\n"
|
||||
text = text .. "Torque Add: "..math.Round(self.TorqueAdd,0).."Tq\n"
|
||||
text = text .. "Weight: "..self.Weight.."Kg"
|
||||
|
||||
self:SetOverlayText( text )
|
||||
end
|
||||
|
||||
--think
|
||||
function ENT:Think()
|
||||
local Time = CurTime()
|
||||
|
||||
if self.LegalThink < Time and self.LastActive+2 > Time then
|
||||
if self:GetPhysicsObject():GetMass() < self.Mass or self:GetParent():IsValid() then
|
||||
self.Legal = false
|
||||
else
|
||||
self.Legal = true
|
||||
end
|
||||
self.LegalThink = Time + (math.floor(1))
|
||||
end
|
||||
|
||||
if self.SuperchargerThink < Time then
|
||||
--Supercharger Boosting
|
||||
if self.RPM >= self.BoostRpmStart then
|
||||
self.Boost = (self.RPM-self.BoostRpmStart)/800
|
||||
else
|
||||
self.Boost = 0
|
||||
end
|
||||
self.BoostMax = (self.LimitRPM-self.BoostRpmStart)/800
|
||||
|
||||
--Add Torque
|
||||
self.TorqueAdd = (((self.Boost/self.BoostMax)*100)*self.TorqueAddMax)/100
|
||||
|
||||
--Create Supercharger Noise Sound
|
||||
if not self.Sound then
|
||||
self.Sound = CreateSound(self, self.SoundPath)
|
||||
self.Sound:PlayEx(0.1,10)
|
||||
end
|
||||
--Change the Supercharger Noise Pitch
|
||||
if self.Sound then
|
||||
self.Sound:ChangePitch(math.min(((((self.Boost/self.BoostMax)*100)*255)/100), 255), 0)
|
||||
self.Sound:ChangeVolume(self.Boost/self.BoostMax, 0)
|
||||
end
|
||||
|
||||
--Set Overlay & Wire Output
|
||||
self:UpdateOverlayText()
|
||||
self:SetWireOutputs()
|
||||
|
||||
self.RPMThink = self.RPM
|
||||
|
||||
self.SuperchargerThink = Time + 0.1
|
||||
end
|
||||
|
||||
|
||||
self:NextThink(Time+0.1)
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
--Get RPM for Supercharger
|
||||
function ENT:GetRPM(IntputRPM, EngLimitRpm, EngWeight, EngThrottle, Class, Torque, IdleRpm)
|
||||
--Reset the supercharger Weight
|
||||
if EngWeight/20-(self.SliderVal*10) >= 10 then
|
||||
if self.Weight != EngWeight/20-(self.SliderVal*10) then
|
||||
self.Weight = EngWeight/20-(self.SliderVal*10)
|
||||
local phys = self:GetPhysicsObject()
|
||||
if IsValid( phys ) then
|
||||
phys:SetMass( self.Weight )
|
||||
end
|
||||
end
|
||||
else
|
||||
if self.Weight > 10 or self.Weight < 10 then
|
||||
self.Weight = 10 --Set the minimum weight
|
||||
local phys = self:GetPhysicsObject()
|
||||
if IsValid( phys ) then
|
||||
phys:SetMass( self.Weight )
|
||||
end
|
||||
end
|
||||
end
|
||||
--Set Persist Values
|
||||
if Class == "GenericPetrol" or Class == "Radial" then
|
||||
self.BoostRpmStart = IdleRpm+((IdleRpm*((self.SliderVal*130)+70))/100) --will vary between 70-200% of the idle rpm range on gazoline
|
||||
elseif Class == "GenericDiesel" or Class == "Wankel" then
|
||||
self.BoostRpmStart = IdleRpm+((IdleRpm*((self.SliderVal*110)+50))/100) --will vary between 50-160% of the idle rpm range on diesel
|
||||
else
|
||||
self.BoostRpmStart = IdleRpm+((IdleRpm*((self.SliderVal*130)+60))/100) --will vary between 60-190% of the idle rpm range on others
|
||||
end
|
||||
self.TorqueAddMax = (Torque*((self.SliderVal*35)+40))/100 --will add between 40-75% of the max engine torque
|
||||
self.RPM = IntputRPM
|
||||
self.LimitRPM = EngLimitRpm
|
||||
|
||||
end
|
||||
|
||||
function ENT:PreEntityCopy()
|
||||
//Wire dupe info
|
||||
self.BaseClass.PreEntityCopy( self )
|
||||
end
|
||||
|
||||
function ENT:PostEntityPaste( Player, Ent, CreatedEntities )
|
||||
//Wire dupe info
|
||||
self.BaseClass.PostEntityPaste( self, Player, Ent, CreatedEntities )
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
for Key,Value in pairs(self.Master) do --Let's unlink ourselves from the engines properly
|
||||
if IsValid( self.Master[Key] ) then
|
||||
self.Master[Key]:Unlink( self )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,391 @@
|
|||
AddCSLuaFile()
|
||||
|
||||
DEFINE_BASECLASS( "base_wire_entity" )
|
||||
|
||||
ENT.PrintName = "ACF Turbo"
|
||||
ENT.WireDebugName = "ACF Turbo"
|
||||
|
||||
if CLIENT then
|
||||
|
||||
function ACFTurboGUICreate( Table )
|
||||
|
||||
if not acfmenupanelcustom.ModData then
|
||||
acfmenupanelcustom.ModData = {}
|
||||
end
|
||||
if not acfmenupanelcustom.ModData[Table.id] then
|
||||
acfmenupanelcustom.ModData[Table.id] = {}
|
||||
acfmenupanelcustom.ModData[Table.id].ModTable = Table.modtable
|
||||
end
|
||||
|
||||
acfmenupanelcustom:CPanelText("Name", Table.name)
|
||||
|
||||
acfmenupanelcustom.CData.DisplayModel = vgui.Create( "DModelPanel", acfmenupanelcustom.CustomDisplay )
|
||||
acfmenupanelcustom.CData.DisplayModel:SetModel( Table.model )
|
||||
acfmenupanelcustom.CData.DisplayModel:SetCamPos( Vector( 250, 325, 250 ) )
|
||||
acfmenupanelcustom.CData.DisplayModel:SetLookAt( Vector( 0, 0, 0 ) )
|
||||
acfmenupanelcustom.CData.DisplayModel:SetFOV( 3 )
|
||||
acfmenupanelcustom.CData.DisplayModel:SetSize(acfmenupanelcustom:GetWide(),acfmenupanelcustom:GetWide())
|
||||
acfmenupanelcustom.CData.DisplayModel.LayoutEntity = function( panel, entity ) end
|
||||
acfmenupanelcustom.CustomDisplay:AddItem( acfmenupanelcustom.CData.DisplayModel )
|
||||
|
||||
acfmenupanelcustom:CPanelText("Desc", "Desc : "..Table.desc.."\n\n")
|
||||
|
||||
for ID,Value in pairs(acfmenupanelcustom.ModData[Table.id]["ModTable"]) do
|
||||
if ID == 1 then
|
||||
ACF_TurboSlider(1, Value, Table.id)
|
||||
elseif ID == 2 then
|
||||
ACF_TurboBOV(2, Value, Table.id)
|
||||
end
|
||||
end
|
||||
|
||||
acfmenupanelcustom.CustomDisplay:PerformLayout()
|
||||
|
||||
end
|
||||
|
||||
function ACF_TurboSlider(Mod, Value, ID)
|
||||
|
||||
acfmenupanelcustom:CPanelText("Spool", " <---- Spool Faster / Boost Bigger ---->")
|
||||
|
||||
if Mod and not acfmenupanelcustom.CData[Mod] then
|
||||
acfmenupanelcustom.CData[Mod] = vgui.Create( "DNumSlider", acfmenupanelcustom.CustomDisplay )
|
||||
acfmenupanelcustom.CData[Mod]:SetWide(100)
|
||||
acfmenupanelcustom.CData[Mod]:SetMin(0.01)
|
||||
acfmenupanelcustom.CData[Mod]:SetMax(1)
|
||||
acfmenupanelcustom.CData[Mod]:SetDecimals(2)
|
||||
acfmenupanelcustom.CData[Mod]["Mod"] = Mod
|
||||
acfmenupanelcustom.CData[Mod]["ID"] = ID
|
||||
acfmenupanelcustom.CData[Mod]:SetValue(Value)
|
||||
acfmenupanelcustom.CData[Mod]:SetDark( true )
|
||||
RunConsoleCommand( "acfcustom_data"..Mod, Value )
|
||||
acfmenupanelcustom.CData[Mod].OnValueChanged = function( slider, val )
|
||||
acfmenupanelcustom.ModData[slider.ID]["ModTable"][slider.Mod] = val
|
||||
RunConsoleCommand( "acfcustom_data"..Mod, val )
|
||||
end
|
||||
acfmenupanelcustom.CustomDisplay:AddItem( acfmenupanelcustom.CData[Mod] )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function ACF_TurboBOV(Mod, Value, ID)
|
||||
RunConsoleCommand( "acfcustom_data"..Mod, Value )
|
||||
acfmenupanelcustom.ModData[ID]["ModTable"][Mod] = Value
|
||||
|
||||
acfmenupanelcustom:CPanelText("BovText", "\n\nBOV(Blow Off Valve) SoundPath :")
|
||||
|
||||
BOVTextEntry = vgui.Create("DTextEntry")
|
||||
BOVTextEntry:SetWide(100)
|
||||
BOVTextEntry:SetTall(30)
|
||||
BOVTextEntry:SetText(Value)
|
||||
BOVTextEntry.OnTextChanged = function()
|
||||
local BOVText = BOVTextEntry:GetValue()
|
||||
RunConsoleCommand( "acfcustom_data"..Mod, BOVText )
|
||||
acfmenupanelcustom.ModData[ID]["ModTable"][Mod] = BOVText
|
||||
end
|
||||
acfmenupanelcustom.CustomDisplay:AddItem( BOVTextEntry )
|
||||
|
||||
acfmenupanelcustom:CPanelText("BovText2", "**Put nothing for No BOV sound**")
|
||||
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
--Persist Values
|
||||
self.Boost = 0
|
||||
self.BoostRate = 0
|
||||
self.BoostRpmStart = 0
|
||||
self.BoostMax = 1
|
||||
self.TorqueAdd = 0
|
||||
self.TorqueAddMax = 1
|
||||
self.RPMAdd = 1000
|
||||
self.RPM = 0
|
||||
self.Throttle = 0
|
||||
--self.RPMThink = 0
|
||||
|
||||
self.GetRpm = true
|
||||
|
||||
--think
|
||||
self.Master = {}
|
||||
self.CanUpdate = true
|
||||
self.Legal = true
|
||||
self.LastActive = 0
|
||||
self.LegalThink = 0
|
||||
self.TurboThink = 0
|
||||
|
||||
Wire_TriggerOutput(self, "Entity", self)
|
||||
self.WireDebugName = "ACF Turbo"
|
||||
|
||||
end
|
||||
|
||||
function MakeACF_Turbo(Owner, Pos, Angle, Id, Data1, Data2)
|
||||
|
||||
if not Owner:CheckLimit("_acf_extra") then return false end
|
||||
|
||||
local Turbo = ents.Create("acf_turbo")
|
||||
if not IsValid( Turbo ) then return false end
|
||||
|
||||
local EID
|
||||
local List = list.Get("ACFCUSTOMEnts")
|
||||
if List.MobilityCustom[Id] then EID = Id else EID = "V1_Turbo" end
|
||||
local Lookup = List.MobilityCustom[EID]
|
||||
|
||||
Turbo:SetAngles(Angle)
|
||||
Turbo:SetPos(Pos)
|
||||
Turbo:Spawn()
|
||||
|
||||
Turbo:SetPlayer(Owner)
|
||||
Turbo.Owner = Owner
|
||||
Turbo.Id = EID
|
||||
Turbo.Model = Lookup.model
|
||||
Turbo.SoundPath = Lookup.sound
|
||||
Turbo.Weight = 30 --this is a basic weight value
|
||||
Turbo.ModTable = Lookup.modtable
|
||||
Turbo.ModTable[1] = Data1
|
||||
Turbo.ModTable[2] = Data2
|
||||
--Set All Mods
|
||||
Turbo.Mods1 = Data1 --Slider
|
||||
Turbo.Mods2 = Data2 --BOV Using
|
||||
|
||||
--Turbo Settings
|
||||
Turbo.SliderVal = tonumber(Turbo.Mods1)
|
||||
Turbo.BOVSound = tostring(Turbo.Mods2)
|
||||
|
||||
--Creating Wire Outputs
|
||||
local Outputs = {"Boost"}
|
||||
local OutputsTypes = {"NORMAL"}
|
||||
Turbo.Outputs = WireLib.CreateSpecialOutputs( Turbo, Outputs, OutputsTypes )
|
||||
|
||||
Turbo:SetModel( Turbo.Model )
|
||||
|
||||
Turbo:PhysicsInit( SOLID_VPHYSICS )
|
||||
Turbo:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
Turbo:SetSolid( SOLID_VPHYSICS )
|
||||
|
||||
local phys = Turbo:GetPhysicsObject()
|
||||
if IsValid( phys ) then
|
||||
phys:SetMass( Turbo.Weight )
|
||||
end
|
||||
|
||||
Owner:AddCount("_acf_turbo", Turbo)
|
||||
Owner:AddCleanup( "acfmenu", Turbo )
|
||||
|
||||
Turbo:SetNetworkedString( "WireName", Lookup.name )
|
||||
Turbo:UpdateOverlayText()
|
||||
Turbo:SetWireOutputs()
|
||||
|
||||
return Turbo
|
||||
end
|
||||
list.Set( "ACFCvars", "acf_turbo" , {"id", "data1", "data2"} )
|
||||
duplicator.RegisterEntityClass("acf_turbo", MakeACF_Turbo, "Pos", "Angle", "Id", "Mods1", "Mods2")
|
||||
|
||||
function ENT:Update( ArgsTable )
|
||||
|
||||
if ArgsTable[1] ~= self.Owner then -- Argtable[1] is the player that shot the tool
|
||||
return false, "You don't own that engine chip!"
|
||||
end
|
||||
|
||||
local Id = ArgsTable[4] -- Argtable[4] is the turbo ID
|
||||
local Lookup = list.Get("ACFCUSTOMEnts").MobilityCustom[Id]
|
||||
|
||||
if Lookup.model ~= self.Model then
|
||||
return false, "The new Engine Chip must have the same model!"
|
||||
end
|
||||
|
||||
if self.Id != Id then
|
||||
self.Id = Id
|
||||
self.Model = Lookup.model
|
||||
self.SoundPath = Lookup.sound
|
||||
self.Weight = 30 --this is a basic weight value
|
||||
end
|
||||
|
||||
self.ModTable[1] = ArgsTable[5]
|
||||
self.ModTable[2] = ArgsTable[6]
|
||||
--Set Mods
|
||||
self.Mods1 = ArgsTable[5] --Slider
|
||||
self.Mods2 = ArgsTable[6] --BOV Using
|
||||
|
||||
--Turbo Settings
|
||||
self.SliderVal = tonumber(self.Mods1)
|
||||
self.BOVSound = tostring(self.Mods2)
|
||||
|
||||
--Creating Wire Outputs
|
||||
local Outputs = {"Boost"}
|
||||
local OutputsTypes = {"NORMAL"}
|
||||
self.Outputs = WireLib.CreateSpecialOutputs( self, Outputs, OutputsTypes )
|
||||
|
||||
self:SetNetworkedString( "WireName", Lookup.name )
|
||||
self:UpdateOverlayText()
|
||||
self:SetWireOutputs()
|
||||
|
||||
return true, "Turbo updated successfully!"
|
||||
end
|
||||
--Set the wire Output
|
||||
function ENT:SetWireOutputs()
|
||||
Wire_TriggerOutput(self, "Boost", math.Round(self.Boost,1))
|
||||
end
|
||||
--Set the Overlay Text
|
||||
function ENT:UpdateOverlayText()
|
||||
local text = ""
|
||||
text = text .. "Boost: "..math.Round(self.Boost,1).." Psi\n"
|
||||
text = text .. "Torque Add: "..math.Round(self.TorqueAdd,0).."Tq\n"
|
||||
if self.BOVSound == "" then
|
||||
text = text .. "Weight: "..self.Weight.."Kg"
|
||||
else
|
||||
text = text .. "Weight: "..self.Weight.."Kg\n"
|
||||
text = text .. "Using BOV"
|
||||
end
|
||||
|
||||
self:SetOverlayText( text )
|
||||
end
|
||||
|
||||
--think
|
||||
function ENT:Think()
|
||||
local Time = CurTime()
|
||||
|
||||
if self.LegalThink < Time and self.LastActive+2 > Time then
|
||||
if self:GetPhysicsObject():GetMass() < self.Mass or self:GetParent():IsValid() then
|
||||
self.Legal = false
|
||||
else
|
||||
self.Legal = true
|
||||
end
|
||||
self.LegalThink = Time + (math.floor(1))
|
||||
end
|
||||
|
||||
if self.TurboThink < Time then
|
||||
/*if self.RPM - self.RPMThink <= -1000 then
|
||||
--Delete and Create the BOV Sound
|
||||
if self.BOVSound != "" then
|
||||
self.SoundBov = CreateSound(self, self.BOVSound)
|
||||
self.SoundBov:PlayEx((self.Boost/self.BoostMax),100)
|
||||
end
|
||||
self.BoostRate = 0
|
||||
self.Boost = 0
|
||||
else*/
|
||||
--Turbo Boost Increasing
|
||||
if self.Throttle >= 0.5 then
|
||||
--increase full throttle
|
||||
if self.RPM >= self.BoostRpmStart then
|
||||
self.BoostRate = self.Boost+(((self.Boost/4)+0.1)*self.Throttle) --boost rate
|
||||
|
||||
if self.Boost < self.BoostMax then
|
||||
self.Boost = self.BoostRate
|
||||
else
|
||||
self.Boost = self.BoostMax
|
||||
end
|
||||
end
|
||||
--Decrease under full throttle
|
||||
if self.RPM <= self.BoostRpmStart-((self.BoostRpmStart*15)/100) then
|
||||
self.BoostRate = self.Boost-(((self.Boost/8)-0.1)*self.Throttle) --boost rate
|
||||
|
||||
if self.Boost > 0 then
|
||||
self.Boost = self.BoostRate
|
||||
elseif self.Boost <= 0 then
|
||||
self.Boost = 0
|
||||
end
|
||||
end
|
||||
--Turbo Boost Decreasing
|
||||
elseif self.Throttle > 0 and self.Throttle < 0.5 then
|
||||
self.BoostRate = self.Boost-(((self.Boost/8)-0.1)*self.Throttle) --boost rate
|
||||
|
||||
if self.Boost > 0 then
|
||||
self.Boost = self.BoostRate
|
||||
elseif self.Boost <= 0 then
|
||||
self.Boost = 0
|
||||
end
|
||||
--Turbo Boost Stop
|
||||
else
|
||||
--Delete and Create the BOV Sound
|
||||
if self.BOVSound != "" then
|
||||
self.SoundBov = CreateSound(self, self.BOVSound)
|
||||
self.SoundBov:PlayEx((self.Boost/self.BoostMax),100)
|
||||
end
|
||||
self.BoostRate = 0
|
||||
self.Boost = 0
|
||||
end
|
||||
--end
|
||||
--Add Torque
|
||||
self.TorqueAdd = (((self.Boost/self.BoostMax)*100)*self.TorqueAddMax)/100
|
||||
|
||||
--Create Turbo Noise Sound
|
||||
if not self.Sound then
|
||||
self.Sound = CreateSound(self, self.SoundPath)
|
||||
self.Sound:PlayEx(0.1,10)
|
||||
end
|
||||
--Change the Turbo Noise Pitch
|
||||
if self.Sound then
|
||||
self.Sound:ChangePitch(math.min(((((self.Boost/self.BoostMax)*100)*255)/100), 255), 0)
|
||||
self.Sound:ChangeVolume(self.Boost/self.BoostMax, 0)
|
||||
end
|
||||
|
||||
--Set Overlay & Wire Output
|
||||
self:UpdateOverlayText()
|
||||
self:SetWireOutputs()
|
||||
|
||||
--self.RPMThink = self.RPM
|
||||
|
||||
self.TurboThink = Time + 0.1
|
||||
end
|
||||
|
||||
|
||||
self:NextThink(Time+0.1)
|
||||
return true
|
||||
|
||||
end
|
||||
|
||||
--Get RPM for Turbo
|
||||
function ENT:GetRPM(IntputRPM, LimitRpm, EngWeight, EngThrottle, Class, Torque)
|
||||
--Reset the turbo Weight
|
||||
if EngWeight/20-(self.SliderVal*10) >= 10 then
|
||||
if self.Weight != EngWeight/20-(self.SliderVal*10) then
|
||||
self.Weight = EngWeight/20-(self.SliderVal*10)
|
||||
local phys = self:GetPhysicsObject()
|
||||
if IsValid( phys ) then
|
||||
phys:SetMass( self.Weight )
|
||||
end
|
||||
end
|
||||
else
|
||||
if self.Weight > 10 or self.Weight < 10 then
|
||||
self.Weight = 10 --Set the minimum weight
|
||||
local phys = self:GetPhysicsObject()
|
||||
if IsValid( phys ) then
|
||||
phys:SetMass( self.Weight )
|
||||
end
|
||||
end
|
||||
end
|
||||
--Set Persist Values
|
||||
if Class == "GenericPetrol" or Class == "Radial" then
|
||||
self.BoostRpmStart = (LimitRpm*((self.SliderVal*30)+40))/100 --will vary between 40-70% of the limit rpm range on gazoline
|
||||
elseif Class == "GenericDiesel" or Class == "Wankel" then
|
||||
self.BoostRpmStart = (LimitRpm*((self.SliderVal*20)+40))/100 --will vary between 40-60% of the limit rpm range on diesel
|
||||
else
|
||||
self.BoostRpmStart = (LimitRpm*((self.SliderVal*25)+40))/100 --will vary between 40-65% of the limit rpm range on others
|
||||
end
|
||||
self.TorqueAddMax = (Torque*((self.SliderVal*35)+40))/100 --will add between 40-75% of the max engine torque
|
||||
--Set Boost Max (Minimum 7psi)
|
||||
if self.TorqueAddMax/10 > 7 then self.BoostMax = self.TorqueAddMax/10
|
||||
else self.BoostMax = 7 end
|
||||
self.RPM = IntputRPM
|
||||
self.Throttle = EngThrottle
|
||||
|
||||
end
|
||||
|
||||
function ENT:PreEntityCopy()
|
||||
//Wire dupe info
|
||||
self.BaseClass.PreEntityCopy( self )
|
||||
end
|
||||
|
||||
function ENT:PostEntityPaste( Player, Ent, CreatedEntities )
|
||||
//Wire dupe info
|
||||
self.BaseClass.PostEntityPaste( self, Player, Ent, CreatedEntities )
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
for Key,Value in pairs(self.Master) do --Let's unlink ourselves from the engines properly
|
||||
if IsValid( self.Master[Key] ) then
|
||||
self.Master[Key]:Unlink( self )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -88,8 +88,8 @@ function TOOL:LeftClick( trace )
|
|||
local Allowed = false
|
||||
if Class == "acf_engine" and ClassMenu != "acf_chips" then Allowed = true end
|
||||
if Class == "acf_gearbox" and ClassMenu != "acf_chips" then Allowed = true end
|
||||
if Class == "acf_engine_custom" and ClassMenu == "acf_engine_maker" then Allowed = true end
|
||||
if Class == "acf_engine_maker" and ClassMenu == "acf_engine_custom" then Allowed = true end
|
||||
if Class == "acf_engine_custom" and ClassMenu == "acf_enginemaker" then Allowed = true end
|
||||
if Class == "acf_enginemaker" and ClassMenu == "acf_engine_custom" then Allowed = true end
|
||||
if Class == "acf_gearboxcvt" and ClassMenu == "acf_gearboxair" then Allowed = true end
|
||||
if Class == "acf_gearboxcvt" and ClassMenu == "acf_gearboxauto" then Allowed = true end
|
||||
if Class == "acf_gearboxair" and ClassMenu == "acf_gearboxcvt" then Allowed = true end
|
||||
|
@ -102,7 +102,7 @@ function TOOL:LeftClick( trace )
|
|||
if Class == "prop_physics" and ClassMenu == "acf_chips" then Welding = true end
|
||||
if Class == "acf_engine" and ClassMenu == "acf_chips" then Welding = true end
|
||||
if Class == "acf_engine_custom" and ClassMenu == "acf_chips" then Welding = true end
|
||||
if Class == "acf_engine_maker" and ClassMenu == "acf_chips" then Welding = true end
|
||||
if Class == "acf_enginemaker" and ClassMenu == "acf_chips" then Welding = true end
|
||||
if Class == "acf_gearbox" and ClassMenu == "acf_chips" then Welding = true end
|
||||
if Class == "acf_gearboxcvt" and ClassMenu == "acf_chips" then Welding = true end
|
||||
if Class == "acf_gearboxair" and ClassMenu == "acf_chips" then Welding = true end
|
||||
|
|
|
@ -18,6 +18,8 @@ local function ReplaceSound( ply , Entity , data)
|
|||
if Entity:GetClass() == "acf_engine_custom" or Entity:GetClass() == "acf_enginemaker" then
|
||||
Entity.SoundPath = sound
|
||||
Entity.SoundPitch = ply:GetInfo("acfcustomsound_pitch")
|
||||
elseif Entity:GetClass() == "acf_turbo" or Entity:GetClass() == "acf_supercharger" then
|
||||
Entity.SoundPath = sound
|
||||
end
|
||||
end)
|
||||
|
||||
|
@ -30,7 +32,7 @@ local function IsReallyValid(trace, ply)
|
|||
local pl = ply;
|
||||
if not trace.Entity:IsValid() then True = false end
|
||||
if trace.Entity:IsPlayer() then True = false end
|
||||
if trace.Entity:GetClass() ~= "acf_engine_custom" and trace.Entity:GetClass() ~= "acf_enginemaker" then True = false end
|
||||
if trace.Entity:GetClass() ~= "acf_engine_custom" and trace.Entity:GetClass() ~= "acf_enginemaker" and trace.Entity:GetClass() ~= "acf_turbo" and trace.Entity:GetClass() ~= "acf_supercharger" then True = false end
|
||||
if SERVER and not trace.Entity:GetPhysicsObject():IsValid() then True = false end
|
||||
|
||||
if True then
|
||||
|
@ -57,6 +59,9 @@ function TOOL:RightClick(trace)
|
|||
self:GetOwner():ConCommand("wire_soundemitter_sound "..trace.Entity.SoundPath);
|
||||
self:GetOwner():ConCommand("acfcustomsound_pitch "..trace.Entity.SoundPitch);
|
||||
ACFCUSTOM_SendNotify( pl, true, "Engine Sound copied successfully!" );
|
||||
elseif trace.Entity:GetClass() == "acf_turbo" or trace.Entity:GetClass() == "acf_supercharger" then
|
||||
self:GetOwner():ConCommand("wire_soundemitter_sound "..trace.Entity.SoundPath);
|
||||
ACFCUSTOM_SendNotify( pl, true, "Turbo or Supercharger Sound copied successfully!" );
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
@ -68,6 +73,10 @@ function TOOL:Reload( trace )
|
|||
local List = list.Get("ACFCUSTOMEnts")
|
||||
self:GetOwner():ConCommand("acfcustomsound_pitch " ..(List["MobilityCustom"][Id]["pitch"] or 1));
|
||||
ReplaceSound( self:GetOwner(), trace.Entity, {List["MobilityCustom"][Id]["sound"]} )
|
||||
elseif trace.Entity:GetClass() == "acf_turbo" or trace.Entity:GetClass() == "acf_supercharger" then
|
||||
local Id = trace.Entity.Id
|
||||
local List = list.Get("ACFCUSTOMEnts")
|
||||
ReplaceSound( self:GetOwner(), trace.Entity, {List["MobilityCustom"][Id]["sound"]} )
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,10 @@
|
|||
"VertexlitGeneric"
|
||||
{
|
||||
"$basetexture" "models/sem/chargers/super_col"
|
||||
"$bumpmap" "models/sem/chargers/super_nor"
|
||||
"$surfaceprop" "metal"
|
||||
"$envmap" "env_cubemap"
|
||||
"$normalmapalphaenvmapmask" "1"
|
||||
"$envmapcontrast" 0.6
|
||||
"$envmapsaturation" 1.0
|
||||
}
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,10 @@
|
|||
"VertexlitGeneric"
|
||||
{
|
||||
"$basetexture" "models/sem/chargers/turbo_col"
|
||||
"$bumpmap" "models/sem/chargers/turbo_nor"
|
||||
"$surfaceprop" "metal"
|
||||
"$envmap" "env_cubemap"
|
||||
"$normalmapalphaenvmapmask" "1"
|
||||
"$envmapcontrast" 0.2
|
||||
"$envmapsaturation" 1.6
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue