1
0
mirror of https://github.com/metrostroi-repo/MetrostroiAddon.git synced 2026-05-04 00:52:33 +00:00
Files
MetrostroiAddon/lua/entities/gmod_train_bogey/shared.lua
2021-01-02 15:32:05 +03:00

62 lines
1.3 KiB
Lua

ENT.Type = "anim"
ENT.Author = ""
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.Category = "Metrostroi (utility)"
ENT.Spawnable = true
ENT.AdminSpawnable = false
physenv.AddSurfaceData([[
"gmod_silent"
{
"impacthard" "DoorSound.Null"
"impactsoft" "DoorSound.Null"
"audiohardnessfactor" "0.0"
"audioroughnessfactor" "0.0"
"scrapeRoughThreshold" "1.0"
"impactHardThreshold" "1.0"
"gamematerial" "X"
}
"gmod_ice"
{
"friction" "0.01"
"elasticity" "0.01"
"audioroughnessfactor" "0.1"
"gamematerial" "X"
}
]])
function ENT:SetupDataTables()
self._NetData = {}
end
function ENT:GetSpeed()
return self:GetNW2Int("Speed")/5
end
function ENT:GetMotorPower()
return self:GetNW2Int("MotorPower")/50
end
function ENT:GetBrakeSqueal()
return self:GetNW2Int("BrakeSqueal")/10
end
if SERVER then
function ENT:SetSpeed(val)
if self._NetData[1] == math.floor(val*5) then return end
self:SetNW2Int("Speed",math.floor(val*5))
end
function ENT:SetMotorPower(val)
if self._NetData[2] == math.floor(val*50) then return end
self:SetNW2Int("MotorPower",math.floor(val*50))
end
function ENT:SetBrakeSqueal(val)
if self._NetData[4] == math.floor(val*10) then return end
self:SetNW2Int("BrakeSqueal",math.floor(val*10))
end
end