170 lines
7.3 KiB
Plaintext
170 lines
7.3 KiB
Plaintext
--@shared
|
|
--@name BMW 850CSi 96
|
|
--@author Opti1337, DarkSupah
|
|
--@include /libs/meshbuilder.txt
|
|
|
|
--@include koptilnya/libs/flux.txt
|
|
|
|
local flux = require("koptilnya/libs/flux.txt")
|
|
local MeshBuilder = require("/libs/meshbuilder.txt")
|
|
|
|
DEBUG_MODE = true
|
|
|
|
local LINK = "https://raw.githubusercontent.com/koptilnya/gmod-data/main/bmw_850csi_96.obj"
|
|
local SCALE = Vector(1)
|
|
|
|
local Materials =
|
|
{
|
|
--[[
|
|
Body = {
|
|
basetexture = "phoenix_storms/fender_white",
|
|
--bumpmap = "models/flat_normal",
|
|
options = {
|
|
flags = 134217728 + 2048,
|
|
--envmap = "env_cubemap",
|
|
--phong = 1,
|
|
--phongalbedotint = 1,
|
|
--phongboost = 6,
|
|
--phongexponent = 80,
|
|
--phongfresnelranges = Vector(1, 1, 1),
|
|
--halflambert = 1,
|
|
--envmapcontrast = 1,
|
|
--envmapsaturation = 0.7,
|
|
--envmaptint = Vector(0.3, 0.3, 0.3),
|
|
--test = Matrix()
|
|
}
|
|
},
|
|
]]
|
|
Body = "phoenix_storms/fender_white",
|
|
Shadow = "models/debug/debugwhite",
|
|
Chrome = "sprops/textures/sprops_chrome",
|
|
BlackPlastic = "models/debug/debugwhite",
|
|
Backface = "models/debug/debugwhite",
|
|
Under = "models/debug/debugwhite",
|
|
Mirror = "debug/env_cubemap_model",
|
|
Zeroblack = "models/debug/debugwhite"
|
|
}
|
|
|
|
local Colors =
|
|
{
|
|
Body = Color(230,230,255),
|
|
Shadow = Color(125,125,125),
|
|
Chrome = Color(255,255,255),
|
|
BlackPlastic = Color(25,25,25),
|
|
Backface = Color(25,25,25),
|
|
Under = Color(0,0,250),
|
|
Mirror = Color(255,255,250),
|
|
Zeroblack = Color(0,0,0)
|
|
}
|
|
|
|
local builder = {}
|
|
|
|
if SERVER then
|
|
builder = MeshBuilder:new(LINK)
|
|
|
|
local this = chip()
|
|
|
|
-- Body
|
|
local body = builder:build("body_a", Vector(0), Angle(0), SCALE, Colors.Body, Materials.Body, this, this)
|
|
builder:build("hood_a", Vector(0), Angle(0), SCALE, Colors.Body, Materials.Body, this, this)
|
|
builder:build("fenders_a", Vector(0), Angle(0), SCALE, Colors.Body, Materials.Body, this, this)
|
|
builder:build("doorhandlelf", Vector(0), Angle(0), SCALE, Colors.Body, Materials.Body, this, this)
|
|
builder:build("bumperf_a", Vector(0), Angle(0), SCALE, Colors.Body, Materials.Body, this, this)
|
|
builder:build("bumperr_a", Vector(0), Angle(0), SCALE, Colors.Body, Materials.Body, this, this)
|
|
builder:build("trunk_a", Vector(0), Angle(0), SCALE, Colors.Body, Materials.Body, this, this)
|
|
builder:build("skirtl_e", Vector(0), Angle(0), SCALE, Colors.Body, Materials.Body, this, this)
|
|
builder:build("wing_d", Vector(0), Angle(0), SCALE, Colors.Body, Materials.Body, this, this)
|
|
builder:build("wingmirrors", Vector(0), Angle(0), SCALE, Colors.Body, Materials.Body, this, this)
|
|
|
|
-- Black plastic
|
|
builder:build("black_plastic", Vector(0), Angle(0), SCALE, Colors.BlackPlastic, Materials.BlackPlastic, this, this)
|
|
|
|
-- Chrome
|
|
builder:build("chrome", Vector(0), Angle(0), SCALE, Colors.Chrome, Materials.Chrome, this, this)
|
|
builder:build("exhaust_d", Vector(0), Angle(0), SCALE, Colors.Chrome, Materials.Chrome, this, this)
|
|
|
|
-- Other
|
|
builder:build("centerconsolebezels_symbols", Vector(0), Angle(0), SCALE, Colors.Shadow, "https://i.imgur.com/p61iQMu.png", this, this)
|
|
builder:build("gaugecluster_a", Vector(0), Angle(0), SCALE, Colors.Shadow, "https://i.imgur.com/VDRC1dz.png", this, this)
|
|
|
|
builder:build("bumperf_badge", Vector(0), Angle(0), SCALE, Color(255,255,255), "https://i.imgur.com/fCG0wsL.jpeg", this, this)
|
|
builder:build("trunk_badge", Vector(0), Angle(0), SCALE, Color(255,255,255), "https://i.imgur.com/fCG0wsL.jpeg", this, this)
|
|
|
|
builder:build("backface", Vector(0), Angle(0), SCALE, Colors.Backface, Materials.Backface, this, this)
|
|
|
|
builder:build("under", Vector(0), Angle(0), SCALE, Colors.Under, Materials.Under, this, this)
|
|
|
|
builder:build("mirror", Vector(0), Angle(0), SCALE, Colors.Mirror, Materials.Mirror, this, this)
|
|
|
|
builder:build("radiator", Vector(0), Angle(0), SCALE, Color(205,205,205), "phoenix_storms/dome", this, this)
|
|
|
|
builder:build("zeroblack", Vector(0), Angle(0), SCALE, Colors.Zeroblack, Materials.Zeroblack, this, this)
|
|
|
|
|
|
builder:build("dashpad_a", Vector(0), Angle(0), SCALE, Colors.Shadow, Materials.Shadow, this, this)
|
|
builder:build("doorcardlf_a", Vector(0), Angle(0), SCALE, Colors.Shadow, Materials.Shadow, this, this)
|
|
builder:build("floor_a", Vector(0), Angle(0), SCALE, Colors.Shadow, Materials.Shadow, this, this)
|
|
|
|
|
|
-- Headlights
|
|
local headlightRpos = Vector(-0.56101, -1.8125, 0.603)
|
|
local headlightRdir = headlightRpos - Vector(-0.48194, -1.8303, 0.60497)
|
|
local headlightRpivot = headlightRdir:getAngle()
|
|
local headlightR = holograms.create(this:localToWorld(headlightRpos * 39.37), this:localToWorldAngles(headlightRpivot), "models/holograms/cube.mdl")
|
|
headlightR:setNoDraw(true)
|
|
headlightR:setParent(this)
|
|
builder:build("headlightr", Vector(0), Angle(0), SCALE, Colors.Body, Materials.Body, headlightR, this)
|
|
builder:build("headlightr_backface", Vector(0), Angle(0), SCALE, Colors.Backface, Materials.Backface, headlightR, this)
|
|
builder:build("headlightr_black_plastic", Vector(0), Angle(0), SCALE, Colors.BlackPlastic, Materials.BlackPlastic, headlightR, this)
|
|
builder:build("headlightr_chrome", Vector(0), Angle(0), SCALE, Colors.Chrome, Materials.Chrome, headlightR, this)
|
|
|
|
|
|
local headlightLpos = Vector(0.56101, -1.8125, 0.603)
|
|
local headlightLdir = Vector(0.48194, -1.8303, 0.60497) - headlightLpos
|
|
local headlightLpivot = headlightLdir:getAngle()
|
|
local headlightL = holograms.create(this:localToWorld(headlightLpos * 39.37), this:localToWorldAngles(headlightLpivot), "models/holograms/cube.mdl")
|
|
headlightL:setNoDraw(true)
|
|
headlightL:setParent(this)
|
|
builder:build("headlightl", Vector(0), Angle(0), SCALE, Colors.Body, Materials.Body, headlightL, this)
|
|
builder:build("headlightl_backface", Vector(0), Angle(0), SCALE, Colors.Backface, Materials.Backface, headlightL, this)
|
|
builder:build("headlightl_black_plastic", Vector(0), Angle(0), SCALE, Colors.BlackPlastic, Materials.BlackPlastic, headlightL, this)
|
|
builder:build("headlightl_chrome", Vector(0), Angle(0), SCALE, Colors.Chrome, Materials.Chrome, headlightL, this)
|
|
|
|
local result = builder:apply()
|
|
|
|
local headlightl = {
|
|
angle = 0
|
|
}
|
|
|
|
local headlightr = {
|
|
angle = 0
|
|
}
|
|
|
|
function openHeadlights()
|
|
flux.to(headlightl, 1, { angle = 2 }):delay(0.3):ease("quartout")
|
|
flux.to(headlightr, 1, { angle = -2 }):ease("quartout")
|
|
end
|
|
|
|
function closeHeadlights()
|
|
flux.to(headlightl, 0.8, { angle = 0 }):delay(0.3):ease("quartout")
|
|
flux.to(headlightr, 0.8, { angle = 0 }):ease("quartout")
|
|
end
|
|
|
|
hook.add("tick", "_tick", function()
|
|
flux.update(game.getTickInterval())
|
|
|
|
headlightR:setAngles(this:localToWorldAngles(headlightRpivot):rotateAroundAxis(headlightR:getForward(), headlightr.angle))
|
|
headlightL:setAngles(this:localToWorldAngles(headlightLpivot):rotateAroundAxis(headlightL:getForward(), headlightl.angle))
|
|
end)
|
|
|
|
wire.adjustPorts({State = "NUMBER"}, {})
|
|
|
|
hook.add("input", "_input", function(name, value)
|
|
if value > 0 then
|
|
openHeadlights()
|
|
else
|
|
closeHeadlights()
|
|
end
|
|
end)
|
|
end
|