`lua/includes/extensions/string.lua:87: bad argument #1 to 'string_len' (string expected, got nil)
Trace:
1: Line 32 "Trace" lua/includes/extensions/debug.lua
2: Line 293 "nil" lua/entities/gmod_wire_expression2/core/e2lib.lua
3: C function "string_len"
4: Line 87 "Explode" lua/includes/extensions/string.lua
5: Line 255 "nil" lua/entities/gmod_wire_expression2/base/preprocessor.lua
6: C function "Execute"
7: Line 245 "CompileCode" lua/entities/gmod_wire_expression2/init.lua
8: Line 437 "Setup" lua/entities/gmod_wire_expression2/init.lua
9: Line 120 "nil" lua/entities/gmod_wire_expression2/init.lua
10: C function "pcall"
11: Line 49 "wire_expression2_reload" lua/entities/gmod_wire_expression2/core/extloader.lua
12: Line 572 "nil" lua/entities/gmod_wire_expression2/core/e2lib.lua`
You should also post the e2 code you attempted to use.
#-------------------------------------
#-- Mech Project by shadowscion
@name mech_project/mech_spawn
@inputs Seat:entity Camera:wirelink
@outputs Ops Cpu
#-- holograms
@persist [Holo_Body Holo_Cockpit Holo_MRLS]:entity
#-- mech variables
@persist [Yaw_MechEntity Yaw_Cockpit] [Pitch_MRLS] Sin Cos
#-- player inputs
@persist [W A S D Shift Space Mouse1 Mouse2] [Active ActiveN Deactivate] PlayerAim:vector
#-- weapons
@persist [MRLS_CanFire MRLS_Wait] [MRLS_Fire MRLS_Sequence MRLS_Tube] MRLS_Active:array MRLS_Data:table MRLS_Pitch
@persist Cannons:array CannonProjectiles:array [RecoilVector]:vector
#-- triggers
@trigger none
if (first()) {
#include "mech_project/mech_lib"
#include "mech_project/mech_holo"
}
if (clk("spawn")) {
local Done = spawn_holograms()
if (Done) {
#-- initialize hologram entities
MechEntity = holoEntity(1)
Holo_Body = holoEntity(2)
Holo_Cockpit = holoEntity(3)
Holo_MRLS = holoEntity(800)
holoUnparent(1)
holoUnparent(1000)
holoDisableShading(908,1)
Camera["Parent",entity] = MechEntity
Camera["Distance",number] = 0
Camera["Position",vector] = vec(0,0,100)
for (I = 1,8) {
local N = 806 + I
local MStartPos = Holo_MRLS:toLocal(holoEntity(N):pos())
MRLS_Data[I,table] = table(
"index" = N,
"entity" = holoEntity(N),
"startPos" = MStartPos
)
}
#-- initialize mech variables
Yaw_MechEntity = MechEntity:angles():yaw()
Yaw_Cockpit = MechEntity:angles():yaw()
Pitch_MRLS = Holo_Cockpit:toLocal(Holo_MRLS:angles()):pitch()
Active = 1
FootLerpRate = 2
FootCycleRate = 0.25
MechMoveSpeed = LegLengthBF + LegLengthBF
PlayerAim = MechEntity:pos() + MechEntity:forward()*1000
MechHeight = 75
#-- initialize mech feet
MechFeet:createFoot("fl",ang(0,45,0):forward()*160):setFootGait(0.00,0.25)
MechFeet:createFoot("fr",ang(0,-45,0):forward()*160):setFootGait(0.50,0.75)
MechFeet:createFoot("rl",ang(0,135,0):forward()*160):setFootGait(0.25,0.50)
MechFeet:createFoot("rr",ang(0,-135,0):forward()*160):setFootGait(0.75,1.00)
MechFeet["fl",table]:setFootSound("soundStepTake","npc/dog/dog_pneumatic2.wav",holoEntity(100),0.50,100)
MechFeet["fl",table]:setFootSound("soundStepDone","doors/drawbridge_stop1.wav",holoEntity(101),0.75,200)
MechFeet["fr",table]:setFootSound("soundStepTake","npc/dog/dog_pneumatic2.wav",holoEntity(200),0.50,100)
MechFeet["fr",table]:setFootSound("soundStepDone","doors/drawbridge_stop1.wav",holoEntity(201),0.75,200)
MechFeet["rl",table]:setFootSound("soundStepTake","npc/dog/dog_pneumatic2.wav",holoEntity(300),0.50,100)
MechFeet["rl",table]:setFootSound("soundStepDone","doors/drawbridge_stop1.wav",holoEntity(301),0.75,200)
MechFeet["rr",table]:setFootSound("soundStepTake","npc/dog/dog_pneumatic2.wav",holoEntity(400),0.50,100)
MechFeet["rr",table]:setFootSound("soundStepDone","doors/drawbridge_stop1.wav",holoEntity(401),0.75,200)
#-- wire instructions
if (!->Seat | !->Camera) { spawn_help() }
#-- start the interval
interval(100)
runOnLast(1)
}
}
if (last()) {
Seat:ejectPod()
Seat:deparent()
Camera["Activated",number] = 0
}
if (clk()) {
dt(90,1)
#-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#-- player and active timer
local Player = (->Seat & ->Camera) ? Seat:driver() : noentity()
if (!Seat:parent()) {
Seat:propFreeze(1)
Seat:setPos(Holo_Cockpit:toWorld(vec(0,0,-15)))
Seat:setAng(Holo_Cockpit:toWorld(ang(0,-90,0)))
rangerFilter(Seat)
rangerPersist(1)
if (Holo_Cockpit:toWorld(vec(0,0,-15)):distance(Seat:pos()) < 1) { Seat:parentTo(Holo_Cockpit) }
}
#-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#-- player entier/exit seat
if (changed(Player)) {
foreach (K,V:entity = players()) {
holoVisible(909,V,0)
holoVisible(910,V,0)
}
if (Player) {
#-- start engine sounds
holoEntity(1):soundPlay("engine1",0,"vehicles/crane/crane_startengine1.wav")
#-- reset camera
Camera["Parent",entity] = holoEntity(908)
Camera["Distance",number] = 0
Camera["Position",vector] = vec()
Camera["Activated",number] = 1
#-- filter player from all traces
rangerFilter(Player)
rangerPersist(1)
holoVisible(909,Player,1)
holoVisible(910,Player,1)
Seat:controls_help(10)
}
else {
#-- reset inputs
W = A = S = D = Space = Shift = Mouse1 = Mouse2 = Sin = Cos = Camera["Activated",number] = 0
PlayerAim = MechEntity:pos() + MechEntity:forward()*1000
Seat:soundPlay("exit",0,"npc/env_headcrabcanister/hiss.wav",3)
}
Deactivate = 0
}
#-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#-- active states
Active = clamp(Active + ((Player:isValid()|MRLS_Active:count()|CannonProjectiles:count()) ?: -1)*DT,0,1)
ActiveN = 1 - Active
#-- if inactive
if (Active == 0) {
#-- convenient timer to deactivate expensive code when inactive
Deactivate = min(1,Deactivate + DT*0.1)
}
#-- if active
elseif (Active == 1) {
if (Player) {
#-- player controls
W = Player:keyForward()
A = Player:keyLeft()
S = Player:keyBack()
D = Player:keyRight()
Space = Player:keyJump()
Shift = Player:keySprint()
Mouse1 = Player:keyAttack1()
Mouse2 = Player:keyAttack2()
PlayerAim = rangerOffset(32768,Player:shootPos(),Seat:toLocalAxis(Player:eye())):position()
if (Player:keyReload()) { Seat:ejectPod() }
}
else {
}
Sin = sin(CT*150)/max(abs($Yaw_MechEntity) + MechMoveDir:length(),1)
Cos = cos(CT*150)/max(abs($Yaw_MechEntity) + MechMoveDir:length(),1)
}
#-- if initializing
if ($Active) {
#-- mix resting height with active height
MechHeight = 40 + (75 - 40)*Active
#-- mix resting footpos with active footpos
MechFeet["fl",table]["restPos",vector] = mix(ang(0,45,0):forward()*160,ang(0,15,0):forward()*175,Active)
MechFeet["fr",table]["restPos",vector] = mix(ang(0,-45,0):forward()*160,ang(0,-15,0):forward()*175,Active)
MechFeet["rl",table]["restPos",vector] = mix(ang(0,135,0):forward()*160,ang(0,165,0):forward()*175,Active)
MechFeet["rr",table]["restPos",vector] = mix(ang(0,-135,0):forward()*160,ang(0,-165,0):forward()*175,Active)
#-- engine sound volume
soundVolume("engine1",Active)
soundVolume("engine2",Active)
if (!Player & Active <= DT) {
soundStop("engine1")
soundStop("engine2")
}
local Open = vec(0,0,ActiveN*135)
holoAng(901,Holo_Cockpit:toWorld((quat(ang(90,0,0))*qRotation(-Open)):toAngle()))
holoAng(904,Holo_Cockpit:toWorld((quat(ang(90,0,0))*qRotation(Open)):toAngle()))
holoAng(603,holoEntity(602):toWorld(ang(-90 - ActiveN*60,180,0)))
holoAng(703,holoEntity(702):toWorld(ang(-90 - ActiveN*60,180,0)))
}
#-- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#-- code is running
if (Deactivate != 1) {
#-- cycle feet
FootLerpRate = lerpN(2,2,Shift)
FootCycleRate = lerpN(0.25,0.50,Shift)
MechMoveDir = (MechEntity:forward()*(W - S) + MechEntity:right()*(D - A)):normalized()*MechMoveSpeed*!MRLS_Fire
MechFeet:cycleAllFeet()
#-- base hologram
holoPos(1,mix(FootAveragePos + vec(0,0,Sin*5 + MechHeight - MRLS_Fire*15) + MechEntity:toWorldAxis(RecoilVector)*3,MechEntity:pos(),0.75))
Yaw_MechEntity = approachAngle(Yaw_MechEntity,(PlayerAim - MechEntity:pos()):toAngle():yaw(),FootCycleRate*45*DT*!MRLS_Fire)
holoAng(1,ang(RecoilVector:x(),Yaw_MechEntity - (1 - Cannons[1,number])*15 + (1 - Cannons[2,number])*15,-RecoilVector:y()))
#-- cockpit & body holograms
local DirY = MechEntity:toLocalAxis((MechFeet["fl",table]["stepPos",vector] + MechFeet["fr",table]["stepPos",vector])*0.5 - (MechFeet["rl",table]["stepPos",vector] + MechFeet["rr",table]["stepPos",vector])*0.5) #-- pitch dir
local DirX = MechEntity:toLocalAxis((MechFeet["fr",table]["stepPos",vector] + MechFeet["rr",table]["stepPos",vector])*0.5 - (MechFeet["fl",table]["stepPos",vector] + MechFeet["rl",table]["stepPos",vector])*0.5) #-- roll dir
local Angle = MechEntity:toWorld(ang(atan(DirY:x(),DirY:z()) - 90 + ActiveN*15 + Cos*5,0,atan(-DirX:y(),DirX:z()) - 90))
holoAng(2,slerp(quat(Angle),quat(Holo_Body),0.5):toAngle())
local CDiff = MechEntity:toLocal((PlayerAim - Holo_Cockpit:pos()):toAngle())
Yaw_Cockpit = approachAngle(Yaw_Cockpit,CDiff:yaw(),FootCycleRate*90*DT)#*!MRLS_Fire)
holoAng(3,MechEntity:toWorld(ang(ActiveN*30 + MRLS_Fire*15,Yaw_Cockpit,0)))
holoAng(909,Holo_Cockpit:angles():setYaw(Yaw_MechEntity))
#-- leg holograms
mech_project_ik(Holo_Body,MechFeet["fl",table]["stepPos",vector],LegLengthCF,LegLengthBF,100,101,102,103,104)
mech_project_ik(Holo_Body,MechFeet["fr",table]["stepPos",vector],LegLengthCF,LegLengthBF,200,201,202,203,204)
mech_project_ik(Holo_Body,MechFeet["rl",table]["stepPos",vector],LegLengthCR,LegLengthBR,300,301,302,303,304)
mech_project_ik(Holo_Body,MechFeet["rr",table]["stepPos",vector],LegLengthCR,LegLengthBR,400,401,402,403,404)
holoEntity(101):hydraulic(114,122)
holoEntity(201):hydraulic(214,222)
holoEntity(301):hydraulic(314,322)
holoEntity(401):hydraulic(414,422)
holoEntity(101):hydraulic(133,117)
holoEntity(201):hydraulic(233,217)
holoEntity(301):hydraulic(333,317)
holoEntity(401):hydraulic(433,417)
#-- mrls system
if (!MRLS_Sequence) {
MRLS_Fire += clamp((Space ?: 0) - MRLS_Fire,-DT*3,DT*3)
MRLS_Pitch = lerpN(-90,clamp(Holo_Cockpit:toLocal((PlayerAim - Holo_MRLS:pos()):toAngle()):pitch(),-90,0),MRLS_Fire)
holoAng(800,Holo_Cockpit:toWorld(ang(MRLS_Pitch,0,0)))
}
else {
holoAng(800,Holo_Cockpit:toWorld(ang(lerpN(-45,MRLS_Pitch,MRLS_Fire),0,0)))
}
if (!MRLS_CanFire) {
if (CT - MRLS_Wait > 5) {
MRLS_CanFire = 1
Holo_MRLS:soundPlay("can_fire_mrls",0,"weapons/physcannon/physcannon_pickup.wav")
for (I = 1,8) {
holoAlpha(MRLS_Data[I,table]["index",number],255)
}
}
}
else {
if (!MRLS_Sequence) {
if (MRLS_Fire == 1 & Mouse1) {
MRLS_CanFire = 0
MRLS_Sequence = 8
}
}
}
if (MRLS_Sequence) {
MRLS_Sequence = max(MRLS_Sequence - DT*2,0)
MRLS_Tube = ceil(MRLS_Sequence)
if (MRLS_Tube > 0) {
local T = MRLS_Data[MRLS_Tube,table]
local V = MRLS_Tube - MRLS_Sequence
T["velocity",number] = 5000*V*V*V*DT
T["randvec",vector] = randvec(-0.05,0.05):setZ(0)
}
if (changed(MRLS_Tube) & MRLS_Tube > 0) {
local T = MRLS_Data[MRLS_Tube,table]
local N = T["index",number]
holoUnparent(N)
holoEntity(N):setTrails(10,1,0.5,"trails/smoke",vec(255,200,200),100)
holoEntity(N):soundPlay("fire_missile_" + MRLS_Tube,1,"weapons/rpg/rocket1.wav")
RecoilVector += MechEntity:toLocalAxis(-Holo_MRLS:forward()*5)
MRLS_Active:pushNumber(MRLS_Tube)
}
}
if (MRLS_Active:count()) {
MRLS_Wait = CT
foreach (K,N:number = MRLS_Active) {
local T = MRLS_Data[N,table]
local N = T["index",number]
local P = rangerOffset(holoEntity(N):pos(),holoEntity(N):pos() + (T["randvec",vector] + holoEntity(N):up())*T["velocity",number])
if (P:hit()) {
local Temp = propSpawn("models/props_phx/misc/potato_launcher_explosive.mdl",P:position(),1),Temp:propBreak()
holoAlpha(N,0)
holoEntity(N):removeTrails()
holoPos(N,Holo_MRLS:toWorld(T["startPos",vector]))
holoAng(N,Holo_MRLS:toWorld(ang(90,0,0)))
holoParent(N,Holo_MRLS)
MRLS_Active:remove(K)
}
else {
holoPos(N,P:position())
}
}
}
#-- cannon system
for (I = 1,2) {
#-- if firing sequence
if (Cannons[I,number]) {
Cannons[I,number] = max(Cannons[I,number] - DT*2,0)
local NextAngle = Cannons[I + 2,number] + (Cannons[I + 2,number] + 120 - Cannons[I + 2,number])*(1 - Cannons[I,number])
local NextQuat = quat(ang(90,0,0))*qRotation(vec(0,0,NextAngle))
holoAng(538 + I*100,holoEntity(535 + I*100):toWorld(NextQuat:toAngle()))
if (Cannons[I,number] == 0) {
Cannons[I + 2,number] = NextAngle
holoEntity(535 + I*100):soundPlay(I + "cannon_reload",0,"weapons/crossbow/reload1.wav")
}
}
#-- if inactive
else {
local Fire = select(I,Mouse1,Mouse2)*!MRLS_Fire
if (Fire) {
local CanShoot = !select(I,Cannons[2,number],Cannons[1,number]) & propCanCreate()
if (CanShoot) {
#-- cannon fire sound
holoEntity(538 + I*100):soundPlay(I + "cannon_fire",0,"weapons/irifle/irifle_fire2.wav")
soundPitch(I + "cannon_fire",65)
#-- cannon fire projectile
local P = propSpawn("models/props_phx/misc/potato_launcher_explosive.mdl",holoEntity(535 + I*100):toWorld(vec(30,0,0)),holoEntity(535 + I*100):toWorld(ang(90,0,0)),0)
P:setAlpha(0),P:setMass(100),P:setTrails(10,1,0.25,"trails/smoke",vec(255,255,135),200)
P:propFreeze(0)
P:applyForce(P:mass()*holoEntity(535 + I*100):forward()*3000)
rangerFilter(P)
CannonProjectiles:pushEntity(P)
#-- cannon fire recoil
RecoilVector += MechEntity:toLocalAxis(-(PlayerAim - holoEntity(538 + I*100):pos()):normalized()*15)
#-- cannon fire sequence
Cannons[I,number] = 1
}
}
}
}
#-- recoil divide toward zero
RecoilVector /= 1.5
#-- explode cannon projectiles
foreach (K,V:entity = CannonProjectiles) {
local R = rangerOffset(V:pos(),V:pos() + V:vel():normalized()*200)
if (R:hit() | V == noentity()) {
CannonProjectiles:remove(K)
V:propBreak()
}
}
#-- left arm holograms
local Diff = Holo_Cockpit:toLocalAxis(PlayerAim - holoEntity(601):pos())
local Dist = min(Diff:length(),60)
local Y = atan(Diff:y(),Diff:x())
local P = atan(Diff:x(),Diff:z()) - icos(Dist,30,30)
local Frac = abs(Diff:normalized():y())*45 + 15 + Cannons[1,number]*25 + Cos*5
holoAng(600,Holo_Cockpit:toWorld(ang(0,Diff:normalized():y()*45 + Cannons[1,number]*25,-25)))
holoAng(601,Holo_Cockpit:toWorld(ang(P + 180 + Frac + ActiveN*75,Y,180)))
holoAng(602,holoEntity(601):toWorld(ang(-icos(30,30,Dist) + 180 + Frac + ActiveN*15,0,0)))
holoEntity(601):hydraulic(624,633)
#-- right arm holograms
local Diff = Holo_Cockpit:toLocalAxis(PlayerAim - holoEntity(701):pos())
local Dist = min(Diff:length(),60)
local Y = atan(Diff:y(),Diff:x())
local P = atan(Diff:x(),Diff:z()) - icos(Dist,30,30)
local Frac = abs(Diff:normalized():y())*45 + 15 + Cannons[2,number]*25 + Cos*5
holoAng(700,Holo_Cockpit:toWorld(ang(0,Diff:normalized():y()*45 - Cannons[2,number]*25,25)))
holoAng(701,Holo_Cockpit:toWorld(ang(P + 180 + Frac + ActiveN*75,Y,180)))
holoAng(702,holoEntity(701):toWorld(ang(-icos(30,30,Dist) + 180 + Frac + ActiveN*15,0,0)))
holoEntity(701):hydraulic(724,733)
}
}
code i used
The include file is needed as well
holo file :
#-------------------------------------
#-- holo data for this mech_project
#-- by shadowscion
@name mech_project/mech_holo
#-- core
@persist [HN CN HS CS] HT:table CR:table ShowSkeleton
#-- info
@persist [LegLengthAF LegLengthBF LegLengthCF] [LegLengthAR LegLengthBR LegLengthCR]
#--------------------------------
#-- hologram spawn function
if (first()) { timer("spawn",15) }
function number spawn_holograms() {
timer("spawn",15)
while (perf() & HS < HN & holoCanCreate()) {
HS++
local Data = HT[HS,array]
local Index = Data[1,number]
local Parent = holoEntity(Data[2,number]) ?: entity()
holoCreate(Index,Parent:toWorld(Data[3,vector]),Data[5,vector]/Data[9,number],Parent:toWorld(Data[4,angle]))
holoParent(Index,Parent)
holoModel(Index,Data[6,string])
holoMaterial(Index,Data[7,string])
holoColor(Index,Data[8,vector4])
if (CR[Index,table]) {
for (K = 1,CR[Index,table]:count()) {
local Clip = CR[Index,table][K,array]
holoClipEnabled(Index,Clip[1,number],1)
holoClip(Index,Clip[2,vector],Clip[3,vector],0)
}
}
}
if (HS >= HN) {
stoptimer("spawn")
printColor(vec(225,255,225),"\nFinished spawning " + HS + " holograms.")
}
return HS >= HN
}
function spawn_help() {
local TextColor = vec(255,255,255)
local InputColor = vec(160,240,160)
local TypeColor = vec(240,160,96)
local OptionColor = vec(255,255,200)
local CheckedY = vec(100,255,100)
local CheckedN = vec(255,100,100)
hint("Mech Project: See chatbox or console for setup instructions",15)
printColor(
TextColor,"- Spawn a jeep seat or other pod and wire the ",InputColor,"Seat",TypeColor," entity",TextColor," input to it.\n",
TextColor,"- Spawn a camera controller and wire the ",InputColor,"Camera",TypeColor," wirelink",TextColor," input to it. Link it to the pod.\n",
TextColor,"- Make sure the camera controller has the following options: \n",
TextColor," - ",OptionColor,"Coordinates local to parent: ",CheckedY,"checked\n",
TextColor," - ",OptionColor,"Clientside movement: ",CheckedY,"checked\n",
TextColor," - ",OptionColor,"Localized movement: ",CheckedN,"unhecked\n",
TextColor," - ",OptionColor,"Clientside zooming: ",CheckedY,"checked\n"
)
}
function entity:controls_help(D) {
This:hintDriver( "Mech Project Controls:",D )
This:hintDriver( "W / S / Shift - Move forward/reverse/sprint",D )
This:hintDriver( "A / D - Strafe left/right",D )
This:hintDriver( "Reload/Use - Exit",D )
This:hintDriver( "Mech will rotate toward your aim position",D )
This:hintDriver( "Cannons can be fired with Mouse1 and Mouse2",D )
This:hintDriver( "MRLS can be fired by holding space and then pressing Mouse1",D )
}
#--------------------------------
#-- inverse kinematics functions
function number icos(A,B,C) {
return acos((A^2 + B^2 - C^2) / (2*A*B))
}
function void mech_project_ik(Base:entity,Target:vector,L1,L2,A,B,C,D,E) {
local DirZ = Base:toLocalAxis(Target - holoEntity(A):pos())
holoAng(A,Base:toWorld(ang(0,atan(DirZ:y(),DirZ:x()),0)))
local DirY = holoEntity(A):toLocalAxis(Target - holoEntity(A):pos())
holoAng(B,holoEntity(A):toWorld(ang(atan(DirY:x(),DirY:z()),0,0)))
local DirY = holoEntity(B):toLocalAxis(Target - holoEntity(C):pos())
local Diff = min(DirY:length() - L1,L2 + L2)
holoAng(C,holoEntity(B):toWorld(ang(-icos(Diff,L2,L2),0,0)))
holoAng(D,holoEntity(C):toWorld(ang(-asin(Diff / (L2+L2)) + 90,0,0)))
holoAng(E,holoEntity(C):toWorld(ang(-icos(L2,L2,Diff) + 180,0,0)))
}
function void entity:hydraulic(A,B) {
local Dir = This:toLocalAxis(holoEntity(B):pos() - holoEntity(A):pos())
holoAng(A,This:toWorld(ang(atan(Dir:x(),Dir:z()) + 90,0,90)))
holoAng(B,This:toWorld(ang(atan(-Dir:z(),Dir:x()),0,90)))
}
function number approach(Cur,Tar,R) {
if (Cur < Tar) {
return clamp(Cur + R,Cur,Tar)
}
elseif (Cur > Tar) {
return clamp(Cur - R,Tar,Cur)
}
return Tar
}
function number approachAngle(Cur,Tar,R) {
local Diff = angnorm(Tar - Cur)
if (Diff > 180) { Diff -= 360 }
return approach(Cur,Cur+Diff,R)
}
function number lerpN(A,B,T) {
return A + (B - A)*T
}
#--------------------------------
#-- inverse kinematics variables
LegLengthAF = 50
LegLengthBF = 50
LegLengthCF = 50
LegLengthAR = 50
LegLengthBR = 50
LegLengthCR = 50
#--------------------------------
#-- hologram data
#-- bone data
local ShowBones = 0
local ShowSkeleton = 0
local BoneModel = "sphere"
local BoneColor = vec4(255,255,255,255*ShowBones)
local BoneScale = vec(6,6,6)
local Ang = ang()
local Vec = vec()
#-- bones: base
HN++,HT[HN,array] = array(1,0,Vec,Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(2,1,Vec,Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(3,2,vec(0,0,35),Ang,BoneScale,BoneModel,"",BoneColor,12)
#-- bones: front left leg
HN++,HT[HN,array] = array(100,2,vec(25,30,-5),Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(101,100,Vec,Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(102,101,vec(0,0,LegLengthAF),Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(103,102,vec(0,0,LegLengthBF),Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(104,103,vec(0,0,LegLengthCF),Ang,BoneScale,BoneModel,"",BoneColor,12)
#HN++,HT[HN,array] = array(105,104,vec(0,0,LegLengthBF),Ang,BoneScale,BoneModel,"",BoneColor,12)
#-- bones: front right leg
HN++,HT[HN,array] = array(200,2,vec(25,-30,-5),Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(201,200,Vec,Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(202,201,vec(0,0,LegLengthAF),Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(203,202,vec(0,0,LegLengthBF),Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(204,203,vec(0,0,LegLengthCF),Ang,BoneScale,BoneModel,"",BoneColor,12)
#HN++,HT[HN,array] = array(205,204,vec(0,0,LegLengthBF),Ang,BoneScale,BoneModel,"",BoneColor,12)
#-- bones: rear left leg
HN++,HT[HN,array] = array(300,2,vec(-25,30,-5),Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(301,300,Vec,Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(302,301,vec(0,0,LegLengthAR),Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(303,302,vec(0,0,LegLengthBR),Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(304,303,vec(0,0,LegLengthCR),Ang,BoneScale,BoneModel,"",BoneColor,12)
#HN++,HT[HN,array] = array(305,304,vec(0,0,LegLengthBR),Ang,BoneScale,BoneModel,"",BoneColor,12)
#-- bones: rear right leg
HN++,HT[HN,array] = array(400,2,vec(-25,-30,-5),Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(401,400,Vec,Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(402,401,vec(0,0,LegLengthAR),Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(403,402,vec(0,0,LegLengthBR),Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(404,403,vec(0,0,LegLengthCR),Ang,BoneScale,BoneModel,"",BoneColor,12)
#HN++,HT[HN,array] = array(405,404,vec(0,0,LegLengthBR),Ang,BoneScale,BoneModel,"",BoneColor,12)
#-- bones: left top arm
HN++,HT[HN,array] = array(600,3,vec(28,34,20),Ang,BoneScale,BoneModel,"",BoneColor,12) #vec(-53,31,55)
HN++,HT[HN,array] = array(601,600,vec(0,31,0),Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(602,601,vec(0,0,30),Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(603,602,vec(0,0,30),ang(-90,180,0),BoneScale,BoneModel,"",BoneColor,12)
#-- bones: right top arm
HN++,HT[HN,array] = array(700,3,vec(28,-34,20),Ang,BoneScale,BoneModel,"",BoneColor,12) #vec(-53,-31,55)
HN++,HT[HN,array] = array(701,700,vec(0,-31,0),Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(702,701,vec(0,0,30),Ang,BoneScale,BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(703,702,vec(0,0,30),ang(-90,180,0),BoneScale,BoneModel,"",BoneColor,12)
if (ShowSkeleton) {
local BoneScale = BoneScale*0.75
local BoneColor = vec4(125,125,125,255)
local BoneModel = "cylinder"
#-- skeleton: front left leg
HN++,HT[HN,array] = array(106,101,vec(0,0,LegLengthAF*0.5),Ang,BoneScale:setZ(LegLengthAF),BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(107,102,vec(0,0,LegLengthBF*0.5),Ang,BoneScale:setZ(LegLengthBF),BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(108,103,vec(0,0,LegLengthCF*0.5),Ang,BoneScale:setZ(LegLengthCF),BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(109,104,vec(0,0,LegLengthBF*0.5),Ang,BoneScale:setZ(LegLengthBF),BoneModel,"",BoneColor,12)
#-- skeleton: front right leg
HN++,HT[HN,array] = array(206,201,vec(0,0,LegLengthAF*0.5),Ang,BoneScale:setZ(LegLengthAF),BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(207,202,vec(0,0,LegLengthBF*0.5),Ang,BoneScale:setZ(LegLengthBF),BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(208,203,vec(0,0,LegLengthCF*0.5),Ang,BoneScale:setZ(LegLengthCF),BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(209,204,vec(0,0,LegLengthBF*0.5),Ang,BoneScale:setZ(LegLengthBF),BoneModel,"",BoneColor,12)
#-- skeleton: rear left leg
HN++,HT[HN,array] = array(306,301,vec(0,0,LegLengthAF*0.5),Ang,BoneScale:setZ(LegLengthAF),BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(307,302,vec(0,0,LegLengthBF*0.5),Ang,BoneScale:setZ(LegLengthBF),BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(308,303,vec(0,0,LegLengthCF*0.5),Ang,BoneScale:setZ(LegLengthCF),BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(309,304,vec(0,0,LegLengthBF*0.5),Ang,BoneScale:setZ(LegLengthBF),BoneModel,"",BoneColor,12)
#-- skeleton: rear right leg
HN++,HT[HN,array] = array(406,401,vec(0,0,LegLengthAF*0.5),Ang,BoneScale:setZ(LegLengthAF),BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(407,402,vec(0,0,LegLengthBF*0.5),Ang,BoneScale:setZ(LegLengthBF),BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(408,403,vec(0,0,LegLengthCF*0.5),Ang,BoneScale:setZ(LegLengthCF),BoneModel,"",BoneColor,12)
HN++,HT[HN,array] = array(409,404,vec(0,0,LegLengthBF*0.5),Ang,BoneScale:setZ(LegLengthBF),BoneModel,"",BoneColor,12)
}
#-- visuals
local Black = vec4(35,35,35,255)
local White = vec4(255,255,255,255)
local Gray = select(randint(1,3),vec4(65,55,55,255),vec4(55,65,55,255),vec4(55,55,65,255))
#-- models/props_debris/building_template022j
#-- models/Cheeze/wires/metal_texture
#-- models/props_c17/metalladder003
local Material1 = "models/props_debris/building_template022j"
local Material2 = ""
#-- visuals: front left leg
HN++,HT[HN,array] = array(110,101,vec(0,0,2),ang(180,0,0),vec(1,1,1),"models/props_combine/breenglobe.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(111,101,vec(0,5,LegLengthAF*0.5+7),ang(0,90,0),vec(0.25,0.35,0.65),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(112,101,vec(0,-5,LegLengthAF*0.5+7),ang(0,90,0),vec(0.25,0.35,0.65),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(113,101,vec(-14,0,13),ang(90,0,0),vec(1,1,1),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(114,101,vec(-14,0,13),ang(20,0,90),vec(0.5,0.5,1),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(115,114,vec(-14,0,0),ang(90,0,0),vec(0.5,0.5,0.75),"models/props_junk/propane_tank001a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(116,101,vec(3,0,LegLengthAF),ang(-90,180,0),vec(2,1,2),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(117,101,vec(18,0,LegLengthAF+2),ang(40,0,90),vec(0.5,0.5,1),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(118,117,vec(-28,0,0),ang(90,0,0),vec(0.5,0.5,1.5),"models/props_junk/propane_tank001a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(119,102,vec(0,0,0),ang(0,0,0),vec(0.125),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(120,102,vec(0,0,LegLengthBF*0.5+5),ang(0,90,0),vec(0.45,0.35,0.65),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(121,102,vec(-13.5,0,LegLengthBF-6),ang(85,0,0),vec(1,0.45,1),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(122,102,vec(-13.5,0,LegLengthBF-6),ang(-20,0,90),vec(0.5,0.5,0.5),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(123,122,vec(-24,0,0),ang(90,0,0),vec(0.125,0.125,4),"cylinder",Material1,White,1)
HN++,HT[HN,array] = array(124,103,vec(0,2.5,0),ang(0,0,0),vec(0.125*0.5),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(125,103,vec(0,-2.5,0),ang(0,0,0),vec(0.125*0.5),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(126,103,vec(0,3,LegLengthCF*0.5),ang(0,90,90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(127,103,vec(0,-3,LegLengthCF*0.5),ang(0,90,90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(128,103,vec(0,3,LegLengthCF*0.5),ang(0,90,-90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(129,103,vec(0,-3,LegLengthCF*0.5),ang(0,90,-90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(130,104,vec(0,0,0),ang(0,0,0),vec(0.125*0.5),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(131,104,vec(0,0,LegLengthBF*0.5),ang(0,90,-90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(132,104,vec(6,0,LegLengthBF*0.5-5),ang(90,0,180),vec(1,0.45,1),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(133,104,vec(6,0,LegLengthBF*0.5-5),ang(180,0,90),vec(0.5,0.5,0.5),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(134,133,vec(-30,0,0),ang(90,0,0),vec(0.125,0.125,5),"cylinder",Material1,White,1)
HN++,HT[HN,array] = array(135,103,vec(-1,0,LegLengthCF*0.5),ang(-90,0,0),vec(1.3,1.35,1.15),"models/props_c17/playground_swingset_seat01a.mdl",Material1,Gray,1)
#-- visuals: front right leg
HN++,HT[HN,array] = array(210,201,vec(0,0,2),ang(180,0,0),vec(1,1,1),"models/props_combine/breenglobe.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(211,201,vec(0,5,LegLengthAF*0.5+7),ang(0,90,0),vec(0.25,0.35,0.65),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(212,201,vec(0,-5,LegLengthAF*0.5+7),ang(0,90,0),vec(0.25,0.35,0.65),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(213,201,vec(-14,0,13),ang(90,0,0),vec(1,1,1),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(214,201,vec(-14,0,13),ang(20,0,90),vec(0.5,0.5,1),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(215,214,vec(-14,0,0),ang(90,0,0),vec(0.5,0.5,0.75),"models/props_junk/propane_tank001a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(216,201,vec(3,0,LegLengthAF),ang(-90,180,0),vec(2,1,2),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(217,201,vec(18,0,LegLengthAF+2),ang(40,0,90),vec(0.5,0.5,1),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(218,217,vec(-28,0,0),ang(90,0,0),vec(0.5,0.5,1.5),"models/props_junk/propane_tank001a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(219,202,vec(0,0,0),ang(0,0,0),vec(0.125),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(220,202,vec(0,0,LegLengthBF*0.5+5),ang(0,90,0),vec(0.45,0.35,0.65),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(221,202,vec(-13.5,0,LegLengthBF-6),ang(85,0,0),vec(1,0.45,1),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(222,202,vec(-13.5,0,LegLengthBF-6),ang(-20,0,90),vec(0.5,0.5,0.5),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(223,222,vec(-24,0,0),ang(90,0,0),vec(0.125,0.125,4),"cylinder",Material1,White,1)
HN++,HT[HN,array] = array(224,203,vec(0,2.5,0),ang(0,0,0),vec(0.125*0.5),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(225,203,vec(0,-2.5,0),ang(0,0,0),vec(0.125*0.5),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(226,203,vec(0,3,LegLengthCF*0.5),ang(0,90,90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(227,203,vec(0,-3,LegLengthCF*0.5),ang(0,90,90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(228,203,vec(0,3,LegLengthCF*0.5),ang(0,90,-90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(229,203,vec(0,-3,LegLengthCF*0.5),ang(0,90,-90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(230,204,vec(0,0,0),ang(0,0,0),vec(0.125*0.5),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(231,204,vec(0,0,LegLengthBF*0.5),ang(0,90,-90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(232,204,vec(6,0,LegLengthBF*0.5-5),ang(90,0,180),vec(1,0.45,1),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(233,204,vec(6,0,LegLengthBF*0.5-5),ang(180,0,90),vec(0.5,0.5,0.5),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(234,233,vec(-30,0,0),ang(90,0,0),vec(0.125,0.125,5),"cylinder",Material1,White,1)
HN++,HT[HN,array] = array(235,203,vec(-1,0,LegLengthCF*0.5),ang(-90,0,0),vec(1.3,1.35,1.15),"models/props_c17/playground_swingset_seat01a.mdl",Material1,Gray,1)
#-- visuals: rear left leg
HN++,HT[HN,array] = array(310,301,vec(0,0,2),ang(180,0,0),vec(1,1,1),"models/props_combine/breenglobe.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(311,301,vec(0,5,LegLengthAF*0.5+7),ang(0,90,0),vec(0.25,0.35,0.65),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(312,301,vec(0,-5,LegLengthAF*0.5+7),ang(0,90,0),vec(0.25,0.35,0.65),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(313,301,vec(-14,0,13),ang(90,0,0),vec(1,1,1),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(314,301,vec(-14,0,13),ang(20,0,90),vec(0.5,0.5,1),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(315,314,vec(-14,0,0),ang(90,0,0),vec(0.5,0.5,0.75),"models/props_junk/propane_tank001a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(316,301,vec(3,0,LegLengthAF),ang(-90,180,0),vec(2,1,2),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(317,301,vec(18,0,LegLengthAF+2),ang(40,0,90),vec(0.5,0.5,1),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(318,317,vec(-28,0,0),ang(90,0,0),vec(0.5,0.5,1.5),"models/props_junk/propane_tank001a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(319,302,vec(0,0,0),ang(0,0,0),vec(0.125),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(320,302,vec(0,0,LegLengthBF*0.5+5),ang(0,90,0),vec(0.45,0.35,0.65),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(321,302,vec(-13.5,0,LegLengthBF-6),ang(85,0,0),vec(1,0.45,1),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(322,302,vec(-13.5,0,LegLengthBF-6),ang(-20,0,90),vec(0.5,0.5,0.5),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(323,322,vec(-24,0,0),ang(90,0,0),vec(0.125,0.125,4),"cylinder",Material1,White,1)
HN++,HT[HN,array] = array(324,303,vec(0,2.5,0),ang(0,0,0),vec(0.125*0.5),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(325,303,vec(0,-2.5,0),ang(0,0,0),vec(0.125*0.5),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(326,303,vec(0,3,LegLengthCF*0.5),ang(0,90,90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(327,303,vec(0,-3,LegLengthCF*0.5),ang(0,90,90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(328,303,vec(0,3,LegLengthCF*0.5),ang(0,90,-90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(329,303,vec(0,-3,LegLengthCF*0.5),ang(0,90,-90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(330,304,vec(0,0,0),ang(0,0,0),vec(0.125*0.5),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(331,304,vec(0,0,LegLengthBF*0.5),ang(0,90,-90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(332,304,vec(6,0,LegLengthBF*0.5-5),ang(90,0,180),vec(1,0.45,1),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(333,304,vec(6,0,LegLengthBF*0.5-5),ang(180,0,90),vec(0.5,0.5,0.5),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(334,333,vec(-30,0,0),ang(90,0,0),vec(0.125,0.125,5),"cylinder",Material1,White,1)
HN++,HT[HN,array] = array(335,303,vec(-1,0,LegLengthCF*0.5),ang(-90,0,0),vec(1.3,1.35,1.15),"models/props_c17/playground_swingset_seat01a.mdl",Material1,Gray,1)
#-- visuals: rear right leg
HN++,HT[HN,array] = array(410,401,vec(0,0,2),ang(180,0,0),vec(1,1,1),"models/props_combine/breenglobe.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(411,401,vec(0,5,LegLengthAF*0.5+7),ang(0,90,0),vec(0.25,0.35,0.65),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(412,401,vec(0,-5,LegLengthAF*0.5+7),ang(0,90,0),vec(0.25,0.35,0.65),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(413,401,vec(-14,0,13),ang(90,0,0),vec(1,1,1),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(414,401,vec(-14,0,13),ang(20,0,90),vec(0.5,0.5,1),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(415,414,vec(-14,0,0),ang(90,0,0),vec(0.5,0.5,0.75),"models/props_junk/propane_tank001a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(416,401,vec(3,0,LegLengthAF),ang(-90,180,0),vec(2,1,2),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(417,401,vec(18,0,LegLengthAF+2),ang(40,0,90),vec(0.5,0.5,1),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(418,417,vec(-28,0,0),ang(90,0,0),vec(0.5,0.5,1.5),"models/props_junk/propane_tank001a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(419,402,vec(0,0,0),ang(0,0,0),vec(0.125),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(420,402,vec(0,0,LegLengthBF*0.5+5),ang(0,90,0),vec(0.45,0.35,0.65),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(421,402,vec(-13.5,0,LegLengthBF-6),ang(85,0,0),vec(1,0.45,1),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(422,402,vec(-13.5,0,LegLengthBF-6),ang(-20,0,90),vec(0.5,0.5,0.5),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(423,422,vec(-24,0,0),ang(90,0,0),vec(0.125,0.125,4),"cylinder",Material1,White,1)
HN++,HT[HN,array] = array(424,403,vec(0,2.5,0),ang(0,0,0),vec(0.125*0.5),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(425,403,vec(0,-2.5,0),ang(0,0,0),vec(0.125*0.5),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(426,403,vec(0,3,LegLengthCF*0.5),ang(0,90,90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(427,403,vec(0,-3,LegLengthCF*0.5),ang(0,90,90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(428,403,vec(0,3,LegLengthCF*0.5),ang(0,90,-90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(429,403,vec(0,-3,LegLengthCF*0.5),ang(0,90,-90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(430,404,vec(0,0,0),ang(0,0,0),vec(0.125*0.5),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(431,404,vec(0,0,LegLengthBF*0.5),ang(0,90,-90),vec(2,4.25,2),"models/props_c17/TrapPropeller_Lever.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(432,404,vec(6,0,LegLengthBF*0.5-5),ang(90,0,180),vec(1,0.45,1),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(433,404,vec(6,0,LegLengthBF*0.5-5),ang(180,0,90),vec(0.5,0.5,0.5),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(434,433,vec(-30,0,0),ang(90,0,0),vec(0.125,0.125,5),"cylinder",Material1,White,1)
HN++,HT[HN,array] = array(435,403,vec(-1,0,LegLengthCF*0.5),ang(-90,0,0),vec(1.3,1.35,1.15),"models/props_c17/playground_swingset_seat01a.mdl",Material1,Gray,1)
#-- visuals: body
HN++,HT[HN,array] = array(500,2,vec(22.5,27.5,0),(vec(25,30,-5)-vec(22.5,27.5,0)):toAngle() + ang(90,0,0),vec(0.45,0.45,0.3),"models/props_wasteland/laundry_basket001.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(501,2,vec(22.5,-27.5,0),(vec(25,-30,-5)-vec(22.5,-27.5,0)):toAngle() + ang(90,0,0),vec(0.45,0.45,0.3),"models/props_wasteland/laundry_basket001.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(502,2,vec(-22.5,27.5,0),(vec(-25,30,-5)-vec(-22.5,27.5,0)):toAngle() + ang(90,0,0),vec(0.45,0.45,0.3),"models/props_wasteland/laundry_basket001.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(503,2,vec(-22.5,-27.5,0),(vec(-25,-30,-5)-vec(-22.5,-27.5,0)):toAngle() + ang(90,0,0),vec(0.45,0.45,0.3),"models/props_wasteland/laundry_basket001.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(504,2,vec(0,0,35),ang(0,0,180),vec(1,1,1),"models/hunter/misc/shell2x2a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(505,3,vec(0,0,0),ang(0,0,0),vec(1,1,1)*0.9,"models/hunter/misc/sphere2x2.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(506,3,vec(0,0,12),ang(0,0,0),vec(1,1,1)*0.9,"models/hunter/tubes/circle2x2.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(507,3,vec(-10,0,15),ang(0,0,0),vec(1,1,0.75)*0.85,"models/props_lab/teleplatform.mdl",Material1,Black,1)
CR[505,table] = table(array(1,vec(0,0,12),vec(0,0,-1)))
#-- visuals: left arm
HN++,HT[HN,array] = array(610,600,vec(0,25,0),ang(0,0,-90),vec(0.25,0.25,0.125),"models/props_wasteland/laundry_basket001.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(611,600,vec(0,25,0),ang(0,-90,0),vec(2,1,1),"models/props_lab/tpplug.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(620,601,vec(0,0,2),ang(180,0,0),vec(0.65),"models/props_combine/breenglobe.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(621,601,vec(0,3,20),ang(0,90,0),vec(0.25,0.25,0.385),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(622,601,vec(0,-3,20),ang(0,90,0),vec(0.25,0.25,0.385),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(623,601,vec(12,0,4),ang(45,180,0),vec(1,1,1),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(624,623,vec(0,0,0),ang(0,0,90),vec(0.5,0.5,1),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(625,624,vec(-16,0,0),ang(90,0,0),vec(0.4,0.4,0.75),"models/props_junk/propane_tank001a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(630,602,vec(0,0,0),ang(0,0,0),vec(0.075),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(631,602,vec(0,0,19),ang(0,90,0),vec(0.25,0.25,0.425),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(632,602,vec(10,0,31),ang(110,180,0),vec(0.75,0.5,0.9),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(633,632,vec(0,0,0),ang(0,0,90),vec(0.5,0.5,0.5),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(634,633,vec(-15,0,0),ang(90,0,0),vec(0.1,0.1,2.5),"cylinder",Material1,White,1)
HN++,HT[HN,array] = array(635,603,vec(-13,7.5,0),ang(0,0,-15),vec(2,1,1),"rcube_thin",Material1,Gray,1)
HN++,HT[HN,array] = array(636,635,vec(6,0,28),ang(180,0,0),vec(0.35,0.35,0.35),"models/props_c17/canister_propane01a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(637,635,vec(-6,0,28),ang(180,0,0),vec(0.35,0.35,0.35),"models/props_c17/canister_propane01a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(638,635,vec(18,0,0),ang(90,0,0),vec(1,1,1),"rcylinder",Material1,Black,1)
HN++,HT[HN,array] = array(639,638,vec(0,-3.25,0):rotate(0,120*0 + 30,0),ang(-90,0,0),vec(3,0.35,0.35),"models/props_c17/pipe_cap003.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(640,638,vec(0,-3.25,0):rotate(0,120*1 + 30,0),ang(-90,0,0),vec(3,0.35,0.35),"models/props_c17/pipe_cap003.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(641,638,vec(0,-3.25,0):rotate(0,120*2 + 30,0),ang(-90,0,0),vec(3,0.35,0.35),"models/props_c17/pipe_cap003.mdl",Material1,Black,1)
#-- visuals: right arm
HN++,HT[HN,array] = array(710,700,vec(0,-25,0),ang(0,0,90),vec(0.25,0.25,0.125),"models/props_wasteland/laundry_basket001.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(711,700,vec(0,-25,0),ang(0,90,0),vec(2,1,1),"models/props_lab/tpplug.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(720,701,vec(0,0,2),ang(180,0,0),vec(0.65),"models/props_combine/breenglobe.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(721,701,vec(0,3,20),ang(0,90,0),vec(0.25,0.25,0.385),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(722,701,vec(0,-3,20),ang(0,90,0),vec(0.25,0.25,0.385),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(723,701,vec(12,0,4),ang(45,180,0),vec(1,1,1),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(724,723,vec(0,0,0),ang(0,0,90),vec(0.5,0.5,1),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(725,724,vec(-16,0,0),ang(90,0,0),vec(0.4,0.4,0.75),"models/props_junk/propane_tank001a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(730,702,vec(0,0,0),ang(0,0,0),vec(0.075),"models/props_wasteland/wheel02a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(731,702,vec(0,0,19),ang(0,90,0),vec(0.25,0.25,0.425),"models/props_c17/gravestone002a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(732,702,vec(10,0,31),ang(110,180,0),vec(0.75,0.5,0.9),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(733,732,vec(0,0,0),ang(0,0,90),vec(0.5,0.5,0.5),"models/props_junk/PopCan01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(734,733,vec(-15,0,0),ang(90,0,0),vec(0.1,0.1,2.5),"cylinder",Material1,White,1)
HN++,HT[HN,array] = array(735,703,vec(-13,-7.5,0),ang(0,0,15),vec(2,1,1),"rcube_thin",Material1,Gray,1)
HN++,HT[HN,array] = array(736,735,vec(6,0,28),ang(180,0,0),vec(0.35,0.35,0.35),"models/props_c17/canister_propane01a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(737,735,vec(-6,0,28),ang(180,0,0),vec(0.35,0.35,0.35),"models/props_c17/canister_propane01a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(738,735,vec(18,0,0),ang(90,0,0),vec(1,1,1),"rcylinder",Material1,Black,1)
HN++,HT[HN,array] = array(739,738,vec(0,-3.25,0):rotate(0,120*0 + 30,0),ang(-90,0,0),vec(3,0.35,0.35),"models/props_c17/pipe_cap003.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(740,738,vec(0,-3.25,0):rotate(0,120*1 + 30,0),ang(-90,0,0),vec(3,0.35,0.35),"models/props_c17/pipe_cap003.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(741,738,vec(0,-3.25,0):rotate(0,120*2 + 30,0),ang(-90,0,0),vec(3,0.35,0.35),"models/props_c17/pipe_cap003.mdl",Material1,Black,1)
#-- visuals: mrls
HN++,HT[HN,array] = array(800,3,vec(-56,0,66),ang(0,0,0),vec(1,4,2),"rcube_thin",Material1,Gray,1)
HN++,HT[HN,array] = array(801,800,vec(24,-24,0)*0.65,ang(0,0,0),vec(1,1,0.9),"models/props_junk/CinderBlock01a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(802,800,vec(24,-8,0)*0.65,ang(0,0,0),vec(1,1,0.9),"models/props_junk/CinderBlock01a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(803,800,vec(24,8,0)*0.65,ang(0,0,0),vec(1,1,0.9),"models/props_junk/CinderBlock01a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(804,800,vec(24,24,0)*0.65,ang(0,0,0),vec(1,1,0.9),"models/props_junk/CinderBlock01a.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(805,800,vec(-12,0,0),ang(0,0,0),vec(4,3.75,1.75),"rcube_thin",Material1,Gray,1)
HN++,HT[HN,array] = array(806,800,vec(0,0,0),ang(0,0,90),vec(0.25,0.25,4.5),"cylinder",Material1,White,1)
HN++,HT[HN,array] = array(807,800,vec(-35,-15.5,4.5),ang(90,0,0),vec(0.25,0.25,1.5),"models/props_phx/misc/flakshell_big.mdl",Material1,White,1)
HN++,HT[HN,array] = array(808,800,vec(-35,-15.5,-4.5),ang(90,0,0),vec(0.25,0.25,1.5),"models/props_phx/misc/flakshell_big.mdl",Material1,White,1)
HN++,HT[HN,array] = array(809,800,vec(-35,-15.5+10,4.5),ang(90,0,0),vec(0.25,0.25,1.5),"models/props_phx/misc/flakshell_big.mdl",Material1,White,1)
HN++,HT[HN,array] = array(810,800,vec(-35,-15.5+10,-4.5),ang(90,0,0),vec(0.25,0.25,1.5),"models/props_phx/misc/flakshell_big.mdl",Material1,White,1)
HN++,HT[HN,array] = array(811,800,vec(-35,15.5,4.5),ang(90,0,0),vec(0.25,0.25,1.5),"models/props_phx/misc/flakshell_big.mdl",Material1,White,1)
HN++,HT[HN,array] = array(812,800,vec(-35,15.5,-4.5),ang(90,0,0),vec(0.25,0.25,1.5),"models/props_phx/misc/flakshell_big.mdl",Material1,White,1)
HN++,HT[HN,array] = array(813,800,vec(-35,15.5-10,4.5),ang(90,0,0),vec(0.25,0.25,1.5),"models/props_phx/misc/flakshell_big.mdl",Material1,White,1)
HN++,HT[HN,array] = array(814,800,vec(-35,15.5-10,-4.5),ang(90,0,0),vec(0.25,0.25,1.5),"models/props_phx/misc/flakshell_big.mdl",Material1,White,1)
#-- visuals: cockpit
HN++,HT[HN,array] = array(900,3,vec(0,33.6,24),ang(0,90,180),vec(1.5,2.25,1),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(901,3,vec(0,33.6,24),ang(90,0,0),vec(1,1,2),"models/props_junk/PopCan01a.mdl",Material1,White,1)
HN++,HT[HN,array] = array(902,901,vec(0,-33.6,0),ang(0,-90,90),vec(1,1,1)*0.7,"models/hunter/misc/shell2x2c.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(903,3,vec(0,-33.6,24),ang(0,-90,180),vec(1.5,2.25,1),"models/props_wasteland/panel_leverHandle001a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(904,3,vec(0,-33.6,24),ang(90,0,0),vec(1,1,2),"models/props_junk/PopCan01a.mdl",Material1,White,1)
HN++,HT[HN,array] = array(905,904,vec(0,33.6,0),ang(0,90,-90),vec(1,1,1)*0.7,"models/hunter/misc/shell2x2c.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(906,3,vec(0,0,-36),ang(0,-45,0),vec(1,1,0.75),"models/hunter/tubes/tube1x1x2b.mdl",Material1,Black,1)
HN++,HT[HN,array] = array(907,3,vec(20,0,15),ang(0,0,0),vec(0.25,3,1),"models/props_junk/CinderBlock01a.mdl",Material1,Gray,1)
HN++,HT[HN,array] = array(908,3,vec(20,0,20),ang(90,0,0),vec(1,2,1),"plane","",vec4(175,0,0,75),1)
#-- visuals: compass
HN++,HT[HN,array] = array(909,3,vec(25,0,18),ang(0,0,0),vec(1,0.125,1),"cplane","",vec4(255,255,0,35),1)
HN++,HT[HN,array] = array(910,3,vec(25,0,18.25),ang(0,0,0),vec(1,0.05,1),"cplane","",vec4(0,255,0,50),1)
CR[909,table] = table(array(1,vec(0,0,0),vec(1,0,0)))
CR[910,table] = table(array(1,vec(0,0,0),vec(1,0,0)))
`
lib file : `#-------------------------------------
#-- a very simple and unperfect library
#-- for holo mech step generation
#-- by shadowscion
@name mech_project/mech_lib
#-- core
@persist [CT DT]
#-- mech
@persist [MechEntity]:entity [MechFeet]:table [MechMoveDir FootAveragePos]:vector [MechMoveSpeed MechEdgeDetect]
#-- constants
@persist [MechHeight Cycle FootCycleRate FootLerpRate]
#[
example usage:
if (first()) {
#include "mech_project/mech_lib"
MechEntity = holoCreate(10)
for (I = 1,4) { holoCreate(I) }
FootLerpRate = 2.00
FootCycleRate = 0.25
MechHeight = 100
MechFeet:createFoot("fl",vec(50,50,0)*2):setFootGait(0.00,0.25)
MechFeet:createFoot("fr",vec(50,-50,0)*2):setFootGait(0.50,0.75)
MechFeet:createFoot("rl",vec(-50,50,0)*2):setFootGait(0.25,0.50)
MechFeet:createFoot("rr",vec(-50,-50,0)*2):setFootGait(0.75,1.00)
}
dt(60,1)
MechFeet:cycleAllFeet()
MechMoveDir = MechEntity:forward()*100
holoPos(10,mix(FootAveragePos + vec(0,0,MechHeight),holoEntity(10):pos(),0.5))
holoAng(10,ang(0,curtime()*0,0))
holoPos(1,MechFeet["fl",table]["stepPos",vector])
holoPos(2,MechFeet["fr",table]["stepPos",vector])
holoPos(3,MechFeet["rl",table]["stepPos",vector])
holoPos(4,MechFeet["rr",table]["stepPos",vector])
]#
#-------------------------------------
#-- constant values
function dt(Interval,TimeScale) {
interval(Interval)
if (!CT) { CT = curtime() }
DT = curtime() - CT
CT = curtime()
DT *= TimeScale
Ops = ops()
Cpu = cpuUsage()*10000
}
MechEdgeDetect = 1
#-------------------------------------
#-- add a new foot
function table table:createFoot(Key:string,RestPos:vector) {
#-- initial foot vectors
local Default = rangerOffset(MechHeight*2,MechEntity:toWorld(RestPos),-MechEntity:up()):position()
#-- table of foot data
This[Key,table] = table(
"key" = Key,
"point0" = Default,#-- bezier start
"point1" = Default,#-- bezier control
"point2" = Default,#-- bezler finish
"stepPos" = Default,#-- end effect of bezier curve
"restPos" = RestPos #-- foot res position
)
return This[Key,table]
}
#-------------------------------------
#-- set foot sounds (soundStepTake,soundStepDone)
function table:setFootSound(Id:string,Path:string,Ent:entity,Volume,Pitch) {
This[Id,string] = Path
This[Id+"Ent",entity] = Ent
This[Id+"Pitch",number] = Pitch
This[Id+"Volume",number] = Volume
}
#-------------------------------------
#-- set when foot should trigger
function table table:setFootGait(Min,Max) {
This["inMin",number] = Min
This["inMax",number] = Max
return This
}
#-------------------------------------
#-- calculate next step coordinates
function void table:setFootTransition() {
#-- set point0 of step to point2 of previous step
This["point0",vector] = This["stepPos",vector] #This["point2",vector]
#-- find suitable point2 of step
local Hull = vec(6,6,1)
local Trace = rangerOffsetHull(MechHeight*4,MechEntity:toWorld(This["restPos",vector]+vec(0,0,MechHeight)) + MechMoveDir*floor(MechEdgeDetect),-MechEntity:up(),-Hull,Hull)
if (Trace:hit()) {
This["point2",vector] = Trace:position()
This["noHit",number] = 0
}
else {
This["noHit",number] = 1 / MechFeet:count()
}
#-- set point1 of step to average of point0 and point2 + z value
local Normal = This["point2",vector] - This["point0",vector]
local ZValue = Normal:toAngle():up() * Normal:length()*0.50
This["point1",vector] = mix(This["point2",vector],This["point0",vector],0.5) + ZValue
#-- reset linear interpolation value
This["lerp",number] = Normal:length() > 5 ? 0 : 1
#-- play a step sound if there is one
if (This["lerp",number] == 0) {
if (This["soundStepTake",string] != "") {
This["soundStepTakeEnt",entity]:soundPlay("step_take" + This["key",string],0,This["soundStepTake",string])
soundPitch("step_take" + This["key",string],This["soundStepTakePitch",number])
soundVolume("step_take" + This["key",string],This["soundStepTakeVolume",number])
}
}
}
#-------------------------------------
#-- perform calculated step
function void table:perfFootTransition() {
#-- linear interpolation from 0-1
if (This["lerp",number] < 1) {
This["lerp",number] = min(This["lerp",number] + DT*FootLerpRate,1)
#-- quadratic bezier curve between the three points
This["stepPos",vector] = bezier(This["point0",vector],This["point1",vector],This["point2",vector],This["lerp",number])
#-- if linear interpolation value is 1,the step is complete
if (This["lerp",number] == 1) {
if (This["soundStepDone",string] != "") {
This["soundStepDoneEnt",entity]:soundPlay("step_done" + This["key",string],0,This["soundStepDone",string])
soundPitch("step_done" + This["key",string],This["soundStepDonePitch",number])
soundVolume("step_done" + This["key",string],This["soundStepDoneVolume",number])
}
}
}
else {
local Hull = vec(6,6,0)
local Trace = rangerOffsetHull(MechHeight*3,This["point2",vector]+vec(0,0,MechHeight),-MechEntity:up(),-Hull,Hull)
This["stepPos",vector] = Trace:position()
}
}
#-------------------------------------
#-- run cycle
function void table:cycleFootTransition() {
#-- if cycle is within min/max
local Trigger = Cycle >= This["inMin",number] & Cycle < This["inMax",number]
#-- only set a transition when trigger value changes
if (This["trigger",number] != Trigger) {
This["trigger",number] = Trigger
if (Trigger) {
This:setFootTransition()
}
}
#-- perform transition with set values
This:perfFootTransition()
#-- add the output position to an average value
FootAveragePos += This["stepPos",vector]
}
#-------------------------------------
#-- run all cycles
function void table:cycleAllFeet() {
#-- increment cycle value by deltatime*rate
Cycle = (Cycle + DT*FootCycleRate) % 1
#-- reset average foot position
FootAveragePos = vec()
#-- edge detection
MechEdgeDetect = 1
#-- loop through every foot
foreach (K,Foot:table = This) {
MechEdgeDetect -= Foot["noHit",number]
Foot:cycleFootTransition()
}
#-- divide average foot position by foot count
FootAveragePos /= MechFeet:count()
}
Would've been better to post files this long as attachments instead so we don't have to scroll for years
Anyway, the error seems to say that the code is trying to use string.Explode on a nil value. So this indicates that an e2 function somewhere in this code says it should return a string, but instead returns nil.
Is this a save? Because most of wiremod doesn't work with saves. If it is, use duplicator or advanced duplicator instead.
The error is happening here https://github.com/wiremod/wire/blob/8ae53270ee708b6b9f504c19936dfd91a06943e0/lua/entities/gmod_wire_expression2/base/preprocessor.lua#L255
which is only possible if the e2 doesn't have any code set on it at all (buffer is nil). Which smells like a save to me.
Tracing it further back,
https://github.com/wiremod/wire/blob/8ae53270ee708b6b9f504c19936dfd91a06943e0/lua/entities/gmod_wire_expression2/init.lua#L119-L121
definitely a save. there's your issue.
Can we make it error sooner so this one doesn't happen again?
you could add a check to the OnRestore function to see if any of the values are nil when they shouldn't be