This commit is contained in:
Nikita Kruglickiy 2021-09-19 22:34:23 +06:00
parent cb9c7b73bb
commit a47d2b43f7
17 changed files with 417 additions and 47 deletions

View File

@ -75,7 +75,17 @@ if SERVER then
builder:build("DoorPanels_body1_model0.003", Vector(0), Angle(0), SCALE, COLORS.Interior, MATERIALS.Interior, chip(), chip())
-- Lights
local StopLights = builder:build("StopLights_body1_model0.016", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
local LeftStopLight1 = builder:build("LR_TurnLight_1_body1_model0.019", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
local LeftStopLight2 = builder:build("LR_TurnLight_2_body1_model0.020", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
local LeftStopLight3 = builder:build("LR_TurnLight_3_body1_model0.021", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
local RightStopLight1 = builder:build("RR_TurnLight_1_body1_model0.016", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
local RightStopLight2 = builder:build("RR_TurnLight_2_body1_model0.023", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
local RightStopLight3 = builder:build("RR_TurnLight_3_body1_model0.022", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
local LeftMirrorTurnLight = builder:build("LeftMirrorTurnLight_body1_model0.024", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
local RightMirrorTurnLight = builder:build("RightMirrorTurnLight_body1_model0.025", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
local LeftBumperTurnLight = builder:build("LeftBumperTurnLight_body1_model0.027", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
local RightMirrorTurnLight = builder:build("RightBumperTurnLight_body1_model0.026", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
local ReverseLights = builder:build("ReverseLight_body1_model0.015", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
local LowBeamLights = builder:build("LowBeamLights_body1_model0.006", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
local HighBeamLights = builder:build("HighBeamLights_body1_model0.017", Vector(0), Angle(0), SCALE, COLORS.LightsBase, MATERIALS.LightsBase, chip(), chip())
@ -84,11 +94,12 @@ if SERVER then
local result = builder:getResult()
local lights = {
StopLights = {Entities = {StopLights}, LerpSpeed = 0.2, Colors = {On = Color(250, 0, 0), Off = Color(30, 0, 0), Active = Color(90, 0, 0)}},
StopLights = {Entities = {LeftStopLight1, LeftStopLight2, LeftStopLight3, RightStopLight1, RightStopLight2, RightStopLight3}, LerpSpeed = 0.2, Colors = {On = Color(250, 0, 0), Off = Color(30, 0, 0), Active = Color(90, 0, 0)}},
ReverseLights = {Entities = {ReverseLights}, LerpSpeed = 0.1, Colors = {On = Color(255, 255, 255), Off = Color(20, 20, 20)}},
LowBeamLights = {Entities = {LowBeamLights}, LerpSpeed = 0.1, Colors = {On = Color(255, 255, 255), Off = Color(20, 20, 20)}},
HighBeamLights = {Entities = {HighBeamLights}, LerpSpeed = 0.1, Colors = {On = Color(255, 255, 255), Off = Color(20, 20, 20)}},
FogLights = {Entities = {FogLights}, LerpSpeed = 0.1, Colors = {On = Color(255, 255, 255), Off = Color(20, 20, 20)}}
TurnLights = {LeftEntities = {LeftStopLight1, LeftStopLight2, LeftStopLight3}, RightEntities = {RightStopLight1, RightStopLight2, RightStopLight3}, LerpSpeed = 0.2, Colors = {On = Color(250, 120, 0), Off = Color(30, 0, 0)}}
}
-- local lightsEntities = {StopLights = {StopLights}, ReverseLights = {ReverseLights}, LowBeamLights = {LowBeamLights}, HighBeamLights = {HighBeamLights}}

View File

@ -6,7 +6,8 @@ require("/koptilnya/mesh_loader/builder.txt")
DEBUG_MODE = true
local LINK = "https://drive.google.com/uc?id=1PvM_NNtdl43L_r2LZz_E9lO_JhWexFxW"
--local LINK = "https://drive.google.com/uc?id=1Z15GAuNhRU3GQ15J9YOSQHk3KrwrOzGE"
local LINK = "http://217.25.221.225/asd.obj"
local SCALE = Vector(0.9)
local builder = {}
@ -15,7 +16,7 @@ if SERVER then
builder = MeshBuilder:new(LINK)
builder:build("Podnojki", Vector(0), Angle(0), SCALE, Color(200, 200, 200), "sprops/textures/sprops_chrome", chip(), chip())
builder:build("Kenguryatnik", Vector(0), Angle(0), SCALE, Color(200, 200, 200), "sprops/textures/sprops_chrome", chip(), chip())
--builder:build("Kenguryatnik", Vector(0), Angle(0), SCALE, Color(200, 200, 200), "sprops/textures/sprops_chrome", chip(), chip())
builder:build("AntennaSerebro", Vector(0), Angle(0), SCALE, Color(200, 200, 200), "sprops/textures/sprops_chrome", chip(), chip())
builder:build("Vihlop", Vector(0), Angle(0), SCALE, Color(200, 200, 200), "sprops/textures/sprops_chrome", chip(), chip())
@ -26,9 +27,9 @@ if SERVER then
builder:build("Nakladki", Vector(0), Angle(0), SCALE, Color(44, 44, 44, 255), "models/debug/debugwhite", chip(), chip())
builder:build("Black", Vector(0), Angle(0), SCALE, Color(0, 0, 0), "models/debug/debugwhite", chip(), chip())
builder:build("SalonKraskiyCvet", Vector(0), Angle(0), SCALE, Color(225, 55, 55), "models/debug/debugwhite", chip(), chip())
builder:build("Korpus", Vector(0), Angle(0), SCALE, Color(155, 0, 0), "models/debug/debugwhite", chip(), chip())
builder:build("Korpus", Vector(0), Angle(0), SCALE, Color(0, 0, 195), "models/shiny", chip(), chip())
builder:build("Salon", Vector(0), Angle(0), SCALE, Color(110, 100, 100), "models/debug/debugwhite", chip(), chip())
builder:build("Sidushki", Vector(0), Angle(0), SCALE, Color(110, 100, 100), "models/debug/debugwhite", chip(), chip())
builder:build("Sidushki", Vector(0), Angle(0), SCALE, Color(110, 100, 100), "WTP/cloth_1", chip(), chip())
builder:build("Vozduhovodi", Vector(0), Angle(0), SCALE, Color(50, 50, 50), "models/debug/debugwhite", chip(), chip())
builder:build("Lampochki", Vector(0), Angle(0), SCALE, Color(255, 255, 255), "models/debug/debugwhite", chip(), chip())
builder:build("Rama", Vector(0), Angle(0), SCALE, Color(80, 80, 80), "models/debug/debugwhite", chip(), chip())
@ -38,7 +39,7 @@ if SERVER then
builder:build("StekloZadneiFari", Vector(0), Angle(0), SCALE, Color(255, 0, 0), "models/debug/debugwhite", chip(), chip())
builder:build("StekloZadneiFari2", Vector(0), Angle(0), SCALE, Color(225, 55, 55), "models/debug/debugwhite", chip(), chip())
builder:build("KorpusZadneiFari", Vector(0), Angle(0), SCALE, Color(225, 55, 55), "models/debug/debugwhite", chip(), chip())
builder:build("Multimedia", Vector(0), Angle(0), SCALE, Color(225, 255, 255), "models/debug/debugwhite", chip(), chip())
builder:build("Multimedia", Vector(0), Angle(0), SCALE, Color(225, 255, 255), "WTP/cloth_1", chip(), chip())
builder:build("KorpusAntenni", Vector(0), Angle(0), SCALE, Color(255, 255, 255), "sprops/textures/sprops_rubber2", chip(), chip())
builder:build("Shnorkel", Vector(0), Angle(0), SCALE, Color(255, 255, 255), "sprops/textures/sprops_rubber2", chip(), chip())

View File

@ -14,14 +14,14 @@ local builder = {}
if SERVER then
builder = MeshBuilder:new(LINK)
builder:build("heli.016", Vector(0), Angle(0), SCALE, Color(0, 203, 0), "models/debug/debugwhite", chip(), chip())
builder:build("heli.001_heli.017", Vector(0), Angle(0), SCALE, Color(255, 225, 255, 90), "models/debug/debugwhite", chip(), chip())
builder:build("heli.002_heli.018", Vector(0), Angle(0), SCALE, Color(255, 225, 255), "models/debug/debugwhite", chip(), chip())
builder:build("heli.003_heli.019", Vector(0), Angle(0), SCALE, Color(231, 0, 0), "models/debug/debugwhite", chip(), chip())
builder:build("heli.004_heli.020", Vector(0), Angle(0), SCALE, Color(96, 96, 203), "models/debug/debugwhite", chip(), chip())
builder:build("heli.005_heli.021", Vector(0), Angle(0), SCALE, Color(130, 130, 130), "models/debug/debugwhite", chip(), chip())
builder:build("heli.006_heli.022", Vector(0), Angle(0), SCALE, Color(255, 224, 0), "models/debug/debugwhite", chip(), chip())
builder:build("heli.007_heli.023", Vector(0), Angle(0), SCALE, Color(255, 225, 255), "models/debug/debugwhite", chip(), chip())
builder:build("heli.016", Vector(0), Angle(0), SCALE, Color(0, 203, 0), "WTP/camoflage_4", chip(), chip())
builder:build("heli.001_heli.017", Vector(0), Angle(0), SCALE, Color(255, 225, 255, 90), "WTP/camoflage_4", chip(), chip())
builder:build("heli.002_heli.018", Vector(0), Angle(0), SCALE, Color(255, 225, 255), "https://i.imgur.com/uLC5dBA.png", chip(), chip())
builder:build("heli.003_heli.019", Vector(0), Angle(0), SCALE, Color(231, 0, 0), "https://i.imgur.com/uLC5dBA.png", chip(), chip())
builder:build("heli.004_heli.020", Vector(0), Angle(0), SCALE, Color(96, 96, 203), "https://i.imgur.com/uLC5dBA.png", chip(), chip())
builder:build("heli.005_heli.021", Vector(0), Angle(0), SCALE, Color(130, 130, 130), "https://i.imgur.com/f2tbMe7.png", chip(), chip())
builder:build("heli.006_heli.022", Vector(0), Angle(0), SCALE, Color(255, 224, 0), "https://i.imgur.com/FQHnxqZ.jpeg", chip(), chip())
builder:build("heli.007_heli.023", Vector(0), Angle(0), SCALE, Color(255, 225, 255), "https://i.imgur.com/uLC5dBA.png", chip(), chip())
builder:getResult()
else

View File

@ -6,7 +6,7 @@ require("/koptilnya/mesh_loader/builder.txt")
DEBUG_MODE = true
local LINK = "https://www.dropbox.com/s/ovw7f8q65tlcdy5/is300.obj?dl=1"
local LINK = "https://www.dropbox.com/s/0vnd3nir8cyolz5/is300_3.obj?dl=1"
local SCALE = Vector(0.8, 0.79, 0.8)
local builder = {}

View File

@ -5,9 +5,9 @@ require("render_device.txt")
RenderDeviceHUD = class("RenderDeviceHUD", RenderDevice)
function RenderDeviceHUD:initialize()
--if player() == owner() then
-- enableHud(player(), true)
--end
if player() == owner() then
enableHud(player(), true)
end
self:setSize(render.getResolution())

View File

@ -13,26 +13,26 @@ local CONFIG = {
},
Clutch = {
DeviceId = 0,
InputId = 4,
Type = JOYSTICK_INPUT_TYPE.Button,
InputId = 2,
Type = JOYSTICK_INPUT_TYPE.Axis,
Handler = function(value)
return math.remap(value, 0, 128, 0, 1)
return math.remap(value, 0, 65535, 0, 1)
end
},
Throttle = {
DeviceId = 0,
InputId = 5,
Type = JOYSTICK_INPUT_TYPE.Button,
InputId = 1,
Type = JOYSTICK_INPUT_TYPE.Axis,
Handler = function(value)
return math.remap(value, 0, 128, 0, 1)
return math.remap(value, 0, 65535, 0, 1)
end
},
Brake = {
DeviceId = 0,
InputId = 2,
Type = JOYSTICK_INPUT_TYPE.Button,
InputId = 5,
Type = JOYSTICK_INPUT_TYPE.Axis,
Handler = function(value)
return math.remap(value, 0, 128, 0, 1)
return math.remap(value, 0, 65535, 0, 1)
end
},
Handbrake = {
@ -45,7 +45,7 @@ local CONFIG = {
},
GearUp = {
DeviceId = 0,
InputId = 1,
InputId = 3,
Type = JOYSTICK_INPUT_TYPE.Button,
Handler = function(value)
return math.remap(value, 0, 128, 0, 1)
@ -53,7 +53,7 @@ local CONFIG = {
},
GearDown = {
DeviceId = 0,
InputId = 3,
InputId = 0,
Type = JOYSTICK_INPUT_TYPE.Button,
Handler = function(value)
return math.remap(value, 0, 128, 0, 1)

220
koptilnya/libs/flux.txt Normal file
View File

@ -0,0 +1,220 @@
--
-- flux
--
-- Copyright (c) 2016 rxi
--
-- This library is free software; you can redistribute it and/or modify it
-- under the terms of the MIT license. See LICENSE for details.
--
local flux = { _version = "0.1.5" }
flux.__index = flux
flux.tweens = {}
flux.easing = { linear = function(p) return p end }
local easing = {
quad = "p * p",
cubic = "p * p * p",
quart = "p * p * p * p",
quint = "p * p * p * p * p",
expo = "2 ^ (10 * (p - 1))",
sine = "-math.cos(p * (math.pi * .5)) + 1",
circ = "-(math.sqrt(1 - (p * p)) - 1)",
back = "p * p * (2.7 * p - 1.7)",
elastic = "-(2^(10 * (p - 1)) * math.sin((p - 1.075) * (math.pi * 2) / .3))"
}
local makefunc = function(str, expr)
local load = loadstring or load
return load("return function(p) " .. str:gsub("%$e", expr) .. " end")()
end
for k, v in pairs(easing) do
flux.easing[k .. "in"] = makefunc("return $e", v)
flux.easing[k .. "out"] = makefunc([[
p = 1 - p
return 1 - ($e)
]], v)
flux.easing[k .. "inout"] = makefunc([[
p = p * 2
if p < 1 then
return .5 * ($e)
else
p = 2 - p
return .5 * (1 - ($e)) + .5
end
]], v)
end
local tween = {}
tween.__index = tween
local function makefsetter(field)
return function(self, x)
local old = self[field]
self[field] = old and function() old() x() end or x
return self
end
end
local function makesetter(field, checkfn, errmsg)
return function(self, x)
if checkfn and not checkfn(x) then
error(errmsg:gsub("%$x", tostring(x)), 2)
end
self[field] = x
return self
end
end
tween.ease = makesetter("_ease",
function(x) return flux.easing[x] end,
"bad easing type '$x'")
tween.delay = makesetter("_delay",
function(x) return type(x) == "number" end,
"bad delay time; expected number")
tween.onstart = makefsetter("_onstart")
tween.onupdate = makefsetter("_onupdate")
tween.oncomplete = makefsetter("_oncomplete")
function tween.new(obj, time, vars)
local self = setmetatable({}, tween)
self.obj = obj
self.rate = time > 0 and 1 / time or 0
self.progress = time > 0 and 0 or 1
self._delay = 0
self._ease = "quadout"
self.vars = {}
for k, v in pairs(vars) do
if type(v) ~= "number" then
error("bad value for key '" .. k .. "'; expected number")
end
self.vars[k] = v
end
return self
end
function tween:init()
for k, v in pairs(self.vars) do
local x = self.obj[k]
if type(x) ~= "number" then
error("bad value on object key '" .. k .. "'; expected number")
end
self.vars[k] = { start = x, diff = v - x }
end
self.inited = true
end
function tween:after(...)
local t
if select("#", ...) == 2 then
t = tween.new(self.obj, ...)
else
t = tween.new(...)
end
t.parent = self.parent
self:oncomplete(function() flux.add(self.parent, t) end)
return t
end
function tween:stop()
flux.remove(self.parent, self)
end
function flux.group()
return setmetatable({}, flux)
end
function flux:to(obj, time, vars)
return flux.add(self, tween.new(obj, time, vars))
end
function flux:update(deltatime)
for i = #self, 1, -1 do
local t = self[i]
if t._delay > 0 then
t._delay = t._delay - deltatime
else
if not t.inited then
flux.clear(self, t.obj, t.vars)
t:init()
end
if t._onstart then
t._onstart()
t._onstart = nil
end
t.progress = t.progress + t.rate * deltatime
local p = t.progress
local x = p >= 1 and 1 or flux.easing[t._ease](p)
for k, v in pairs(t.vars) do
t.obj[k] = v.start + x * v.diff
end
if t._onupdate then t._onupdate() end
if p >= 1 then
flux.remove(self, i)
if t._oncomplete then t._oncomplete() end
end
end
end
end
function flux:clear(obj, vars)
for t in pairs(self[obj]) do
if t.inited then
for k in pairs(vars) do t.vars[k] = nil end
end
end
end
function flux:add(tween)
-- Add to object table, create table if it does not exist
local obj = tween.obj
self[obj] = self[obj] or {}
self[obj][tween] = true
-- Add to array
table.insert(self, tween)
tween.parent = self
return tween
end
function flux:remove(x)
if type(x) == "number" then
-- Remove from object table, destroy table if it is empty
local obj = self[x].obj
self[obj][self[x]] = nil
if not next(self[obj]) then self[obj] = nil end
-- Remove from array
self[x] = self[#self]
return table.remove(self)
end
for i, v in ipairs(self) do
if v == x then
return flux.remove(self, i)
end
end
end
local bound = {
to = function(...) return flux.to(flux.tweens, ...) end,
update = function(...) return flux.update(flux.tweens, ...) end,
remove = function(...) return flux.remove(flux.tweens, ...) end,
}
setmetatable(bound, flux)
return bound

View File

@ -0,0 +1,60 @@
-- @shared
local PERMISSIONS_BUILDER = PERMISSIONS_BUILDER or {}
if CLIENT then
PERMISSIONS_BUILDER.list = PERMISSIONS_BUILDER.list or {}
local function onPermissionsGained()
PERMISSIONS_BUILDER:onPermissionsGained()
net.start("onPermissionsGained")
net.send()
end
function PERMISSIONS_BUILDER:add(permission)
if not table.hasValue(self.list, permission) then
table.insert(self.list, permission)
end
end
function PERMISSIONS_BUILDER:build(description)
description = description or ""
local allPermissionsGained = true
for k, v in pairs(self.list) do
if not hasPermission(v) then
allPermissionsGained = false
break
end
end
if allPermissionsGained then
onPermissionsGained()
else
setupPermissionRequest(self.list, description, true)
hook.add("permissionrequest", "PERMISSIONS_BUILDER_permissionrequest", function()
if permissionRequestSatisfied() then
onPermissionsGained()
end
end)
end
end
-- STUB
function PERMISSIONS_BUILDER:onPermissionsGained()
end
else
net.receive("onPermissionsGained", function(len, ply)
PERMISSIONS_BUILDER:onPermissionsGained(ply)
end)
-- STUB
function PERMISSIONS_BUILDER:onPermissionsGained(ply)
end
end
return PERMISSIONS_BUILDER

View File

@ -68,3 +68,6 @@ function byteTable(str, start, length)
return result
end
function isURL(str)
return string.match(str, "^https?://") ~= nil
end

View File

@ -2,8 +2,10 @@
-- @client
-- @include /koptilnya/libs/table.txt
-- @include obj_parser.txt
-- @include /koptilnya/libs/utils.txt
require("/koptilnya/libs/table.txt")
require("obj_parser.txt")
require("/koptilnya/libs/utils.txt")
MeshBuilder = class("MeshBuilder")
@ -26,6 +28,21 @@ function MeshBuilder:initialize(link)
self:_applyMeshes()
end
self._cachedMaterials = {}
if player() == owner() then
net.receive("initialized", function()
net.readEntity(function(ply)
notification.addProgress(tostring(ply:getUserID()), string.format("%s is loading mesh", ply:getName()))
end)
end)
net.receive("obj_parsed", function()
net.readEntity(function(ply)
notification.kill(tostring(ply:getUserID()))
end)
end)
end
net.start("initialized")
net.send()
@ -37,10 +54,18 @@ function MeshBuilder:initialize(link)
while hasNext == 1 do
local name = net.readString()
local mat = net.readTable()
net.readEntity(function(ent)
local holo = ent:toHologram()
local object = {name = name, holo = holo}
if (isURL(mat.basetexture)) then
mat = self:_createMaterial(mat.shader, mat.basetexture, mat.bumpmap, mat.options)
else
mat = material.load(mat.basetexture)
end
local object = {name = name, mat = mat, holo = holo}
table.insert(self._objects, object)
end)
@ -59,6 +84,7 @@ function MeshBuilder:_applyMeshes()
for _, v in pairs(self._objects) do
if self.meshData[v.name] ~= nil then
v.holo:setMesh(self.meshData[v.name])
v.holo:setMeshMaterial(v.mat)
v.holo:setRenderBounds(Vector(-200), Vector(200))
v.meshApplied = true
end
@ -69,6 +95,57 @@ function MeshBuilder:_applyMeshes()
end
end
function MeshBuilder:_setTexture(mat, name, texture)
if isURL(texture) then
mat:setTextureURL(name, texture, function(_, _, _, _, layout)
layout(0, 0, 1024, 1024)
end)
else
mat:setTexture(name, texture)
end
end
function MeshBuilder:_createMaterial(shader, basetexture, bumpmap, options)
shader = shader or "VertexLitGeneric"
basetexture = basetexture or "models/debug/debugwhite"
bumpmap = bumpmap or ""
options = options or {}
local checksum = crc(shader .. basetexture .. bumpmap .. json.encode(options))
if self._cachedMaterials[checksum] ~= nil then
return self._cachedMaterials[checksum]
end
local mat = material.create(shader)
self:_setTexture(mat, "$basetexture", basetexture)
if bumpmap ~= "" then
self:_setTexture(mat, "$bumpmap", bumpmap)
end
for k, v in pairs(options) do
if type(v) == "string" then
mat:setString("$" .. k, v)
elseif type(v) == "number" then
if string.match(tostring(v), "%.") then
mat:setFloat("$" .. k, v)
else
mat:setInt("$" .. k, v)
end
elseif type(v) == "nil" then
mat:setUndefined("$" .. k, v)
elseif type(v) == "Vector" then
mat:setVector("$" .. k, tostring(v))
end
end
self._cachedMaterials[checksum] = mat
return mat
end
-- STUB
function MeshBuilder:onObjLoaded(objData)

View File

@ -21,7 +21,6 @@ function ObjParser:initialize(link)
local objData
http.get(link, function(response)
objData = response
objData = string.gsub(response, "\nl%s%d+%s%d+", "")
end)
while not objData do

View File

@ -17,17 +17,17 @@ function MeshBuilder:initialize(link, modelPlaceholder)
self._firstTimeSended = false
net.receive("obj_parsed", function(len, ply)
if DEBUG_MODE then
print(string.format("%s parsed the .obj", ply:getName()))
end
net.start("obj_parsed")
net.writeEntity(ply)
net.send(owner())
self:onPlayerParsedObj(ply)
end)
net.receive("initialized", function(len, ply)
if DEBUG_MODE then
print(string.format("%s initialized", ply:getName()))
end
net.start("initialized")
net.writeEntity(ply)
net.send(owner())
table.insert(self._playersWithAccess, ply)
@ -74,10 +74,6 @@ function MeshBuilder:initialize(link, modelPlaceholder)
self:onObjectLoaded(objData)
for object in string.gmatch(objData, "^?\n?o%s([%w_%.%-]+)") do
table.insert(self._objectsNames, object)
end
self:onObjectParsed(self._objectsNames)
return 2
@ -93,6 +89,7 @@ function MeshBuilder:_sendObjects(target)
for _, v in pairs(self._objectsToSend) do
net.writeBit(1)
net.writeString(v.name)
net.writeTable(type(v.mat) == "table" and v.mat or { basetexture = tostring(v.mat) })
net.writeEntity(v.holo)
end
net.writeBit(0)
@ -116,14 +113,13 @@ function MeshBuilder:build(name, pos, ang, scale, color, mat, parent, relativeTo
local holo = holograms.create(pos, ang, self.modelPlaceholder, scale)
holo:setColor(color)
holo:setMaterial(mat)
if isValid(parent) then
holo:setParent(parent)
end
table.insert(self._objects, {name = name, holo = holo})
table.insert(self._objects, {name = name, mat = mat, holo = holo})
return holo
end

View File

@ -9,7 +9,10 @@
-- @include /koptilnya/gui/elements/shape.txt
-- @include /koptilnya/gui/elements/button.txt
-- @include /koptilnya/gui/segoe_mdl2_assets_icons.txt
local points = {Vector(0, 0), Vector(100, 0)}
local points = {
Vector(0, 0),
Vector(100, 0)
}
local zoom = 1
local zoomBase = 100
local scroll = 0
@ -458,7 +461,7 @@ hook.add("render", "_render", function()
x, y = fromWorkspacePos(segmentSize * i, 0)
local length = 20
local text = tostring(math.remap(i, 0, 10, 1000, 6000)) -- tostring(i * 10)
local text = tostring(math.remap(i, 0, 10, 1000, 7000)) -- tostring(i * 10)
render.drawRect(x, y - 20, 1, 20)
render.drawRect(x - segmentSize / 2, y - 10, 1, 10)