mirror of
https://github.com/dvdvideo1234/TrackAssemblyTool.git
synced 2025-03-04 03:13:32 -05:00
Switch vector and angle types to use userdata types (#38)
* https://github.com/wiremod/wire/pull/2399
This commit is contained in:
parent
7426ceb36b
commit
4ab6010f5d
@ -92,7 +92,7 @@ local asmlib = trackasmlib; if(not asmlib) then -- Module present
|
||||
------------ CONFIGURE ASMLIB ------------
|
||||
|
||||
asmlib.InitBase("track","assembly")
|
||||
asmlib.SetOpVar("TOOL_VERSION","8.692")
|
||||
asmlib.SetOpVar("TOOL_VERSION","8.693")
|
||||
asmlib.SetIndexes("V" ,1,2,3)
|
||||
asmlib.SetIndexes("A" ,1,2,3)
|
||||
asmlib.SetIndexes("WV",1,2,3)
|
||||
|
@ -88,30 +88,23 @@ e2function array entity:trackasmlibSnapEntity(vector trHitPos , string hdModel
|
||||
number nActRadius, number enFlatten, number enIgnTyp,
|
||||
vector ucsOffPos , angle ucsOffAng)
|
||||
if(not (this and this:IsValid() and enFlag)) then return {} end
|
||||
local stSpawn = asmlib.GetEntitySpawn(self.player, this, asmlib.ToVector(trHitPos, wvX, wvY, wvZ),
|
||||
hdModel, hdPoID, nActRadius,(enFlatten ~= 0), (enIgnTyp ~= 0),
|
||||
ucsOffPos[wvX], ucsOffPos[wvY], ucsOffPos[wvZ],
|
||||
ucsOffAng[waP], ucsOffAng[waY], ucsOffAng[waR])
|
||||
local stSpawn = asmlib.GetEntitySpawn(self.player, this, trHitPos, hdModel, hdPoID,
|
||||
nActRadius, (enFlatten ~= 0), (enIgnTyp ~= 0),
|
||||
ucsOffPos[cvX], ucsOffPos[cvY], ucsOffPos[cvZ],
|
||||
ucsOffAng[caP], ucsOffAng[caY], ucsOffAng[caR])
|
||||
if(not stSpawn) then return {} end
|
||||
local sPos = {stSpawn.SPos[cvX], stSpawn.SPos[cvY], stSpawn.SPos[cvZ]}
|
||||
local sAng = {stSpawn.SAng[caP], stSpawn.SAng[caY], stSpawn.SAng[caR]}
|
||||
return {sPos, sAng}
|
||||
return {Vector(stSpawn.SPos), Angle(stSpawn.SAng)}
|
||||
end
|
||||
|
||||
__e2setcost(80)
|
||||
e2function array trackasmlibSnapNormal(vector ucsPos, angle ucsAng , string hdModel,
|
||||
number hdPoID, vector ucsOffPos, angle ucsOffAng)
|
||||
if(not enFlag) then return {} end
|
||||
local stSpawn = asmlib.GetNormalSpawn(self.player,
|
||||
asmlib.ToVector(ucsPos, wvX, wvY, wvZ),
|
||||
asmlib.ToAngle(ucsAng, waP, waY, waR),
|
||||
ucsAng,hdModel,hdPoID,
|
||||
ucsOffPos[wvX],ucsOffPos[wvY],ucsOffPos[wvZ],
|
||||
ucsOffAng[waP],ucsOffAng[waY],ucsOffAng[waR])
|
||||
local stSpawn = asmlib.GetNormalSpawn(self.player, ucsPos, ucsAng, hdModel, hdPoID,
|
||||
ucsOffPos[cvX], ucsOffPos[cvY], ucsOffPos[cvZ],
|
||||
ucsOffAng[caP], ucsOffAng[caY], ucsOffAng[caR])
|
||||
if(not stSpawn) then return {} end
|
||||
local sPos = {stSpawn.SPos[cvX], stSpawn.SPos[cvY], stSpawn.SPos[cvZ]}
|
||||
local sAng = {stSpawn.SAng[caP], stSpawn.SAng[caY], stSpawn.SAng[caR]}
|
||||
return {sPos, sAng}
|
||||
return {Vector(stSpawn.SPos), Angle(stSpawn.SAng)}
|
||||
end
|
||||
|
||||
--[[ **************************** PIECES **************************** ]]
|
||||
|
@ -855,12 +855,6 @@ end
|
||||
|
||||
------------- ANGLE ---------------
|
||||
|
||||
function ToAngle(aBase, pP, pY, pR)
|
||||
if(not aBase) then LogInstance("Base invalid"); return nil end
|
||||
local aP, aY, aR = UseIndexes(pP, pY, pR, caP, caY, caR)
|
||||
return Angle((tonumber(aBase[aP]) or 0), (tonumber(aBase[aY]) or 0), (tonumber(aBase[aR]) or 0))
|
||||
end
|
||||
|
||||
function SnapAngle(aBase, nvDec)
|
||||
if(not aBase) then LogInstance("Base invalid"); return nil end
|
||||
local D = (tonumber(nvDec) or 0); if(D <= 0) then
|
||||
@ -891,12 +885,6 @@ end
|
||||
|
||||
------------- VECTOR ---------------
|
||||
|
||||
function ToVector(vBase, pX, pY, pZ)
|
||||
if(not vBase) then LogInstance("Base invalid"); return nil end
|
||||
local vX, vY, vZ = UseIndexes(pX, pY, pZ, cvX, cvY, cvZ)
|
||||
return Vector((tonumber(vBase[vX]) or 0), (tonumber(vBase[vY]) or 0), (tonumber(vBase[vZ]) or 0))
|
||||
end
|
||||
|
||||
function AddVector(vBase, vUnit)
|
||||
if(not vBase) then LogInstance("Base invalid"); return nil end
|
||||
if(not vUnit) then LogInstance("Unit invalid"); return nil end
|
||||
|
Loading…
Reference in New Issue
Block a user