Improved Racelogic; Kal
This commit is contained in:
parent
47dba04e08
commit
a017e473c0
@ -6,7 +6,7 @@ require("/koptilnya/mesh_loader/builder.txt")
|
||||
|
||||
DEBUG_MODE = true
|
||||
|
||||
local LINK = "https://drive.google.com/u/0/uc?id=1Q4V8lHwTIw3ccJrRWiiwf0WTwSE3qbWb&export=download"
|
||||
local LINK = "https://raw.githubusercontent.com/koptilnya/gmod-data/main/a6.obj"
|
||||
local SCALE = Vector(1)
|
||||
|
||||
local Materials =
|
||||
|
||||
@ -37,7 +37,8 @@ if SERVER then
|
||||
Настраиваем конкретный меш
|
||||
(название_объекта, позиция, угол, размер, цвет, материал, парент, относительно_чего_позиционировать)
|
||||
]]
|
||||
builder:build("wheel", Vector(0), Angle(0), SCALE, Color(255, 255, 255), "sprops/textures/sprops_rubber", chip(), chip())
|
||||
builder:build("tire", Vector(0), Angle(0), SCALE, Color(255, 255, 255), "sprops/textures/sprops_rubber", chip(), chip())
|
||||
builder:build("disk", Vector(0), Angle(0), SCALE, Color(255, 255, 255), "sprops/textures/sprops_rubber", chip(), chip())
|
||||
|
||||
--[[
|
||||
Получаем текущий результат и отправляем его по возможности клиентам. Обычно вызывается после всех вызовов build
|
||||
|
||||
@ -6,8 +6,7 @@ require("/koptilnya/mesh_loader/builder.txt")
|
||||
|
||||
DEBUG_MODE = true
|
||||
|
||||
--local LINK = "https://drive.google.com/uc?id=1Z15GAuNhRU3GQ15J9YOSQHk3KrwrOzGE"
|
||||
local LINK = "http://217.25.221.225/asd.obj"
|
||||
local LINK = "https://drive.google.com/uc?id=1Z15GAuNhRU3GQ15J9YOSQHk3KrwrOzGE"
|
||||
local SCALE = Vector(0.9)
|
||||
|
||||
local builder = {}
|
||||
@ -21,7 +20,7 @@ if SERVER then
|
||||
builder:build("Vihlop", Vector(0), Angle(0), SCALE, Color(200, 200, 200), "sprops/textures/sprops_chrome", chip(), chip())
|
||||
|
||||
builder:build("Podtumanniki", Vector(0), Angle(0), SCALE, Color(100, 100, 100), "models/debug/debugwhite", chip(), chip())
|
||||
builder:build("Nomera", Vector(0), Angle(0), SCALE, Color(54, 225, 220), "sprops/sprops_grid_orange_12x12", chip(), chip())
|
||||
builder:build("Nomera", Vector(0), Angle(0), SCALE, Color(54, 225, 220), "https://i.imgur.com/ZVrOGSu.jpeg", chip(), chip())
|
||||
builder:build("Okna", Vector(0), Angle(0), SCALE, Color(0, 0, 0, 200), "models/debug/debugwhite", chip(), chip())
|
||||
builder:build("Skobi", Vector(0), Angle(0), SCALE, Color(55, 55, 55, 255), "models/debug/debugwhite", chip(), chip())
|
||||
builder:build("Nakladki", Vector(0), Angle(0), SCALE, Color(44, 44, 44, 255), "models/debug/debugwhite", chip(), chip())
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
require("/koptilnya/mesh_loader/builder.txt")
|
||||
|
||||
local LINK = "https://www.dropbox.com/s/uu2tia6ac13cobu/jdmwheel1.obj?dl=1"
|
||||
local LINK = "https://raw.githubusercontent.com/koptilnya/gmod-data/main/jdmwheel1.obj?d=1"
|
||||
local SCALE = Vector(0.6)
|
||||
local MATERIALS = {
|
||||
Center = "models/debug/debugwhite",
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
-- @name koptilnya/libs/workers
|
||||
|
||||
WORKERS = {}
|
||||
WORKERS_QUOTA = 0.5
|
||||
WORKERS_QUOTA = 0.4
|
||||
|
||||
local function execWorker(worker)
|
||||
local status
|
||||
|
||||
@ -49,6 +49,8 @@ local currentResult = {
|
||||
time = 0
|
||||
}
|
||||
},
|
||||
distance = 0,
|
||||
quarter = 0,
|
||||
maxSpeed = 0
|
||||
}
|
||||
local results = {}
|
||||
@ -112,7 +114,7 @@ end
|
||||
|
||||
function setSpeed(value)
|
||||
value = math.clamp(value, 0, 999)
|
||||
value = math.round(value)
|
||||
value = math.floor(value)
|
||||
|
||||
local str = string.rep("0", 3 - #tostring(value)) .. value
|
||||
|
||||
@ -152,6 +154,8 @@ function reset()
|
||||
end
|
||||
|
||||
currentResult.maxSpeed = 0
|
||||
currentResult.quarter = 0
|
||||
currentResult.distance = 0
|
||||
|
||||
setTime(0)
|
||||
setSpeed(0)
|
||||
@ -180,6 +184,11 @@ function printResult(result)
|
||||
print(Color(255, 255, 255), string.format(format, 100, 200, math.abs(result.triggers[200].time - result.triggers[100].time)))
|
||||
end
|
||||
|
||||
if (result.quarter > 0) then
|
||||
print(Color(255, 255, 255), string.format("Quarter: %.02fs", result.quarter))
|
||||
end
|
||||
|
||||
print(Color(200, 200, 200), string.format("Distance: %.02fm", result.distance))
|
||||
print(Color(200, 200, 200), string.format("Max speed: %.02f km/h", result.maxSpeed))
|
||||
end
|
||||
|
||||
@ -191,8 +200,9 @@ hook.add("tick", "_tick", function()
|
||||
local localVelocityLength = localVelocity:getLength()
|
||||
local MPH = localVelocityLength * (15 / 352)
|
||||
local KPH = MPH * 1.609
|
||||
local roundedSpeed = math.floor(KPH)
|
||||
|
||||
if KPH < 1 and active then
|
||||
if roundedSpeed < 1 and active then
|
||||
if hasResult() then
|
||||
saveResult()
|
||||
|
||||
@ -203,7 +213,7 @@ hook.add("tick", "_tick", function()
|
||||
end
|
||||
|
||||
reset()
|
||||
elseif not active and MPH >= 1 then
|
||||
elseif not active and roundedSpeed >= 1 then
|
||||
active = true
|
||||
startTime = timer.systime()
|
||||
end
|
||||
@ -228,6 +238,14 @@ hook.add("tick", "_tick", function()
|
||||
end
|
||||
end
|
||||
|
||||
currentResult.distance = currentResult.distance + KPH * game.getTickInterval() / 3.6
|
||||
|
||||
if (currentResult.quarter == 0 and currentResult.distance >= 402.33) then
|
||||
currentResult.quarter = timer.systime() - startTime
|
||||
|
||||
chip():emitSound(reachSoundPath)
|
||||
end
|
||||
|
||||
if hold and holdTime + holdDuration <= timer.systime() then
|
||||
hold = false
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user