Notifications
Clear all

let's point it out


Potsmoke66
(@potsmoke66)
Captain Registered
Joined: 7 years ago
Posts: 1815
Topic starter  

now i like to know what exactly is so unmaintainable 😕

what exactly is so complicated or complex?

is there anything not reasonable?

can it be solved better?

or do we really like poor animated "shoe-boxes"?

Code:
--[[ first the scanner sub-model, it's ment to be placed in to the sub-models but as long as only this ship uses it…
it has no textures but they aren't really needed i guess.

define_model('rhoombha_d_scan_sub', {
info = {
lod_pixels = { .1, 20, 50, 0 },
bounding_radius = 40,
materials = {'chrome', 'red', 'steel', 'hole'},
},

static = function(lod)
set_material('chrome', .5,.6,.65,1, 1.2,1.3,1.6,30)
set_material('red', .4, 0, 0,1, .5, .5, .5, 10)
set_material('steel', .3,.33,.35,1, .6,.4,.4,30)
set_material('hole', 0,0,0,0, 0,0,0,0, 0,0,0)

-- build the joints
use_material('chrome')
sphere(2, Matrix.translate(v(3.2,0,0)) * Matrix.scale(v(.5,.5,.5)) )
sphere(2, Matrix.translate(v(-3.2,0,0)) * Matrix.scale(v(.5,.5,.5)) )

-- build the inside "saucer" for the scanner
set_insideout(true)
sphere_slice(12*lod,8*lod, 0, 0.5*math.pi, Matrix.translate(v(0,0,-.5)) * Matrix.rotate(.5*math.pi,v(1,0,0)) * Matrix.scale(v(2.9,1.9,2.9)) )
set_insideout(false)

-- build the "antenna"
ring(4*lod, v(0,0,-.5), v(0,0,1.5), v(0,1,0), .1)

use_material('red')
sphere(2, Matrix.translate(v(0,0,-.5)) * Matrix.scale(v(.25,.25,.25)) )

-- cuts a hole in the outside sphere slice for the "saucer"
use_material('hole')
zbias(1,v(0,0,0),v(0,0,-1))
circle(12*lod, v(0,0,-.5), v(0,0,-1), v(0,1,0), 2.8)
zbias(0)

-- build the outside "saucer"
use_material('steel')
sphere_slice(12*lod,8*lod, 0, 0.5*math.pi, Matrix.translate(v(0,0,-.5)) * Matrix.rotate(.5*math.pi,v(1,0,0)) * Matrix.scale(v(3,2,3)) )
end
})

define_model('rhoombha_d_scan_0', {
info = {
lod_pixels = { .1, 20, 50, 0 },
bounding_radius = 40,
materials = {'chrome','steel'},
},

static = function(lod)
set_material('chrome', .5,.6,.65,1, 1.2,1.3,1.6,30)
set_material('steel', .3,.33,.35,1, .6,.4,.4,30)

-- build the base mounting
use_material('steel')
circle(8*lod,v(0,1,0),v(0,1,0),v(0,0,1),3.5)

use_material('chrome')
xref_ring(4*lod, v(3.2,5,0), v(3.2,1,1.2), v(1,0,0), .2)
xref_ring(4*lod, v(3.2,5,0), v(3.2,1,-1.2), v(1,0,0), .2)

end,
dynamic = function(lod)

-- attach the "saucer" and animate "x rotation"
local factor = (get_time('SECONDS')*2)*math.pi
call_model('rhoombha_d_scan_sub', v(0,5.5,0), v(1,0,0), v(0,math.cos(factor),math.sin(factor)),1)
end
})

define_model('rhoombha_d_scanner', {
info = {
lod_pixels = { .1, 20, 50, 0 },
bounding_radius = 40,
materials = {'metal'},
},

static = function(lod)

-- (p)reserved model for the typhoon
zbias(1,v(0,0,0),v(0,-1,0))
load_obj('ant_l0.obj')

set_material('metal', .3,.35,.33,1,.6,.75,.8,30)
use_material('metal')
load_obj('ant_l1.obj')
zbias(0)

-- create the final mounting
local scanpos = v(-12.3,2.8,0)
tube(8*lod, scanpos + v(0,.4,0), scanpos + v(0,-.1,0),v(0,0,1), .875, 1)

-- calls the odd antenna sub-model at proper position on the ship, to call the model together with the scanner when a scanner is fitted
call_model('antenna_1',v(-7.681,-3.607,-9.4),v(1,0,0),v(0,1,0),1)
end,
dynamic = function(lod)

-- call the scanner sub-model and animate "y rotation"
local scanpos = v(-12.3,2.8,0)
local factor = (get_time('SECONDS')*0.33)*math.pi
call_model('rhoombha_d_scan_0', scanpos + v(0,.1,0), v(math.cos(-factor),0,math.sin(-factor)), v(0,1,0),.25)
end
})

-- make a model from the gun object
define_model('rhoombha_d_gun', {
info = {
bounding_radius = 40,
materials = {'b_chrome','black'},
},
static = function(lod)
set_material('b_chrome', .63,.7,.83,1,1.2,1.5,1.6,30)
set_material('black', 0,0,0,1,0,0,0,0)

use_material('b_chrome')
load_obj('gun0.obj')

use_material('black')
zbias(1,v(0,0,0),v(0,0,-1))
load_obj('gun1.obj')
zbias(0)
end
})

-- make a optional mounting for the rear gun
define_model('rhoombha_d_r_gun', {
info = {
bounding_radius = 40,
materials = {'metal'},
},
static = function(lod)
set_material('metal', .3,.35,.33,1,.6,.75,.8,30)
use_material('metal')

use_material('metal')
load_obj('r_gun0.obj')
end
})

-- covers the right missile pylon when not used
define_model('rhoombha_d_pyl_r', {
info = {
bounding_radius = 40,
materials = {'metal'},
},
static = function(lod)
set_material('metal', .3,.35,.33,1,.6,.75,.8,30)
use_material('metal')
load_obj('pyl_r.obj')
end
})

-- covers the left missile pylon when not used
define_model('rhoombha_d_pyl_l', {
info = {
bounding_radius = 40,
materials = {'metal'},
},
static = function(lod)
set_material('metal', .3,.35,.33,1,.6,.75,.8,30)
use_material('metal')
load_obj('pyl_l.obj')
end
})

-- covers the scanner mounting when scanner isn't used
define_model('rhoombha_d_cover', {
info = {
bounding_radius = 40,
materials = {'metal'},
},
static = function(lod)
set_material('metal', .3,.35,.33,1,.6,.75,.8,30)
use_material('metal')
zbias(1,v(0,0,0),v(0,1,0))
load_obj('cover0.obj')
zbias(0)
end
})

-- model for the ECM, you will see why i didn't call this it in the main model
define_model('rhoombha_d_ecm', {
info = {
bounding_radius = 40,
materials = {'metal'},
},
static = function(lod)

-- loads mounting for the ECM and is the reason for the call of the ECM models here
zbias(1,v(0,0,0),v(0,-1,0))
load_obj('ant_r0.obj')

set_material('metal', .3,.35,.33,1,.6,.75,.8,30)
use_material('metal')
load_obj('ant_r1.obj')
zbias(0)
end,
dynamic = function(lod)
-- selects either basic or advanced ECM model
if get_equipment('ECM') == 'ECM_BASIC' then
call_model('ecm_1a',v(7.681,-3.607,-9.4), v(-1,0,0),v(0,-1,0),1)
elseif get_equipment('ECM') == 'ECM_ADVANCED' then
call_model('ecm_2a',v(7.681,-3.607,-9.4), v(-1,0,0),v(0,-1,0),1)
end
end
})

-- model for the scoop
define_model('rhoombha_d_scoop', {
info = {
lod_pixels = { .1, 20, 50, 0 },
bounding_radius = 40,
materials = {'b_chrome','inside'},
},

static = function(lod)
if lod > 1 then
set_material('b_chrome', .63,.7,.83,1,1.2,1.5,1.6,30)
set_material('inside', .1,.1,.08,1,.05,.05,.05,10)

-- has no material, because i like to set the random material only once if possible
zbias(1,v(0,0,0),v(0,-1,0))
load_obj('scoop0.obj')

-- i don't like to have reflective material on the inside
use_material('inside')
load_obj('scoop1.obj')

-- but i like high specularity for chrome parts
use_material('b_chrome')
load_obj('scoop2.obj')
zbias(0)
else
-- i tried to position the collision checking for the scoop a little in front of the scoop, i guess that makes sense, besides of that this model has a "real hole" and need that anyway
geomflag(0x100)
load_obj('scoop3.obj')
geomflag(0)
end
end
})

-- model for the "door", actually not animated for real, but left for enhancement
define_model('rhoombha_d_door', {
info = {
bounding_radius = 40,
materials = {'metal'},
},
static = function(lod)

-- again no random material, no dynamic part
zbias(1,v(0,0,0),v(0,-1,0))
load_obj('door1.obj', Matrix.rotate(math.pi*0.06129,v(1,0,0)) * Matrix.rotate(math.pi*0.5,v(-1,0,0)))
zbias(0)
set_material('metal', .3,.35,.33,1,.6,.75,.8,30)
use_material('metal')
load_obj('door0.obj', Matrix.rotate(math.pi*0.06129,v(1,0,0)) * Matrix.rotate(math.pi*0.5,v(-1,0,0))) --1/180*11.032° = 0.06129
end
})

-- model for the right UC flap
define_model('rhoombha_d_flap_r', {
info = {
lod_pixels = { .1, 20, 50, 0 },
bounding_radius = 40,
materials = {'metal'},
},

static = function(lod)

-- again no random material, no dynamic part
zbias(1,v(0,0,0),v(0,-1,0))
load_obj('flap_r1.obj', Matrix.rotate(math.pi*0.5,v(-1,0,0)))
zbias(0)
if lod > 1 then
set_material('metal', .3,.35,.33,1,.6,.75,.8,30)
use_material('metal')
end
load_obj('flap_r0.obj', Matrix.rotate(math.pi*0.5,v(-1,0,0)))
end
})

-- model for the left UC flap
define_model('rhoombha_d_flap_l', {
info = {
lod_pixels = { .1, 20, 50, 0 },
bounding_radius = 40,
materials = {'metal'},
},

static = function(lod)

-- again no random material, no dynamic part
zbias(1,v(0,0,0),v(0,-1,0))
load_obj('flap_l1.obj', Matrix.rotate(math.pi*0.5,v(-1,0,0)))
zbias(0)
if lod > 1 then
set_material('metal', .3,.35,.33,1,.6,.75,.8,30)
use_material('metal')
end
load_obj('flap_l0.obj', Matrix.rotate(math.pi*0.5,v(-1,0,0)))
end
})

-- the pad the ship should land on, needs a model like all parts of a rig, can make models very complex
define_model('rhoombha_d_pad0', {
info = {
lod_pixels = { .1, 20, 50, 0 },
bounding_radius = 40,
materials = {'metal','d_chrome'},
},

static = function(lod)
if lod > 1 then
if lod > 3 then
set_material('metal', .3,.35,.33,1,.6,.75,.8,30)
set_material('d_chrome', .4,.43,.45,1,1.2,1.5,1.6,30)
use_material('d_chrome')
load_obj('pad0.obj', Matrix.scale(v(1.2,1.2,1)) * Matrix.rotate(.5*math.pi,v(1,0,0)))
end
use_material('metal')
end
load_obj('pad1.obj', Matrix.scale(v(1.2,1.2,1)) * Matrix.rotate(.5*math.pi,v(1,0,0)))
end
})

-- all right side rig
-- rotates the pad on y axis, which will be later on the model the z axis
define_model('rhoombha_d_pad1_r', {
info = {
lod_pixels = { .1, 20, 50, 0 },
bounding_radius = 40,
materials = {'metal','d_chrome'},
},

static = function(lod)
end,
dynamic = function(lod)
local rot = 3.142*math.clamp(get_animation_position('WHEEL_STATE')-.5,0,1) *0.15
local pos = 3.142*1.05 -- .65
call_model('rhoombha_d_pad0',v(0,0,0),v(math.cos(pos+rot),0,math.sin(pos+rot)),v(0,1,0),1)
end
})

-- "upper leg"
define_model('rhoombha_d_leg0_r', {
info = {
lod_pixels = { .1, 20, 50, 0 },
bounding_radius = 40,
materials = {'d_chrome'},
},

static = function(lod)
if lod > 1 then
set_material('d_chrome', .4,.43,.45,1,1.2,1.5,1.6,30)
use_material('d_chrome')
load_obj('leg1.obj', Matrix.rotate(.5*math.pi,v(1,0,0)))
end
end,
dynamic = function(lod)
local rot = 3.142*math.clamp(get_animation_position('WHEEL_STATE')-.5,0,1) *0.4
local pos = 3.142*0.2
call_model('rhoombha_d_pad1_r',v(0,-2.978,-0.862),v(1,0,0),v(0,math.cos(pos+rot),math.sin(pos+rot)),1)
end
})

-- "lower leg"
define_model('rhoombha_d_leg1_r', {
info = {
lod_pixels = { .1, 20, 50, 0 },
bounding_radius = 40,
materials = {'d_chrome'},
},

static = function(lod)
if lod > 1 then
set_material('d_chrome', .4,.43,.45,1,1.2,1.5,1.6,30)
use_material('d_chrome')
load_obj('leg0.obj', Matrix.rotate(.5*math.pi,v(1,0,0)))
end
end,
dynamic = function(lod)
local rot = 3.142*math.clamp(get_animation_position('WHEEL_STATE')-.5,0,1) *1.27 +0.8
call_model('rhoombha_d_leg0_r',v(0,3.713,-0.527),v(1,0,0),v(0,math.cos(-rot),math.sin(-rot)),1)
end
})

-- assembling of the complete Undercarriage
define_model('rhoombha_d_uc_r', {
info = {
lod_pixels = { .1, 20, 50, 0 },
bounding_radius = 40,
materials = {'d_chrome'},
},

static = function(lod)
if lod > 3 then
set_material('d_chrome', .4,.43,.45,1,1.2,1.5,1.6,30)
use_material('d_chrome')
load_obj('axle.obj', Matrix.rotate(.5*math.pi,v(1,0,0)))
end
end,
dynamic = function(lod)
local rot = 3.142*math.clamp(get_animation_position('WHEEL_STATE')-.5,0,1) *0.8 +0.25
call_model('rhoombha_d_leg1_r',v(0,0,0),v(1,0,0),v(0,math.cos(rot),math.sin(rot)),1)
end
})

-- all left side rig
define_model('rhoombha_d_pad1_l', {
info = {
lod_pixels = { .1, 20, 50, 0 },
bounding_radius = 40,
materials = {'metal','d_chrome'},
},

static = function(lod)
end,
dynamic = function(lod)
local rot = 3.142*math.clamp(get_animation_position('WHEEL_STATE')-.5,0,1) *0.15
local pos = 3.142*1.55 --1.05 -- .65
call_model('rhoombha_d_pad0',v(0,0,0),v(math.sin(pos+rot),0,math.cos(pos+rot)),v(0,1,0),1)
end
})

define_model('rhoombha_d_leg0_l', {
info = {
lod_pixels = { .1, 20, 50, 0 },
bounding_radius = 40,
materials = {'d_chrome'},
},

static = function(lod)
if lod > 1 then
set_material('d_chrome', .4,.43,.45,1,1.2,1.5,1.6,30)
use_material('d_chrome')
load_obj('leg1.obj', Matrix.rotate(.5*math.pi,v(1,0,0)))
end
end,
dynamic = function(lod)
local rot = 3.142*math.clamp(get_animation_position('WHEEL_STATE')-.5,0,1) *0.4
local pos = 3.142*0.2
call_model('rhoombha_d_pad1_l',v(0,-2.978,-0.862),v(1,0,0),v(0,math.cos(pos+rot),math.sin(pos+rot)),1)
end
})

define_model('rhoombha_d_leg1_l', {
info = {
lod_pixels = { .1, 20, 50, 0 },
bounding_radius = 40,
materials = {'d_chrome'},
},

static = function(lod)
if lod > 1 then
set_material('d_chrome', .4,.43,.45,1,1.2,1.5,1.6,30)
use_material('d_chrome')
load_obj('leg0.obj', Matrix.rotate(.5*math.pi,v(1,0,0)))
end
end,
dynamic = function(lod)
local rot = 3.142*math.clamp(get_animation_position('WHEEL_STATE')-.5,0,1) *1.27 +0.8
call_model('rhoombha_d_leg0_l',v(0,3.713,-0.527),v(1,0,0),v(0,math.cos(-rot),math.sin(-rot)),1)
end
})

define_model('rhoombha_d_uc_l', {
info = {
lod_pixels = { .1, 20, 50, 0 },
bounding_radius = 40,
materials = {'d_chrome'},
},

static = function(lod)
if lod > 3 then
set_material('d_chrome', .4,.43,.45,1,1.2,1.5,1.6,30)
use_material('d_chrome')
load_obj('axle.obj', Matrix.rotate(.5*math.pi,v(1,0,0)))
end
end,
dynamic = function(lod)
local rot = 3.142*math.clamp(get_animation_position('WHEEL_STATE')-.5,0,1) *0.8 +0.25
call_model('rhoombha_d_leg1_l',v(0,0,0),v(1,0,0),v(0,math.cos(rot),math.sin(rot)),1)
end
})

-- finally the main model
define_model('rhoombha_d', {
info = {
scale = 1,
lod_pixels = { .1, 20, 50, 0 },
bounding_radius = 35,
materials = {'rand','metal','text','win','b_chrome','d_chrome','pit','inside','black','posl_r','posl_g','cwarn'},
tags = {'ship'},
ship_defs = {
{
name='Rhoombha D Type',
forward_thrust = -16e6,
reverse_thrust = 8e6,
up_thrust = 5e6,
down_thrust = -5e6,
left_thrust = -5e6,
right_thrust = 5e6,
angular_thrust = 8e7,
gun_mounts =
{
{ v(0,-1.9,-16), v(0,0,-1) },
{ v(0,-4.1,16), v(0,0,1) },
},
max_cargo = 80,
max_laser = 2,
max_missile = 4,
capacity = 80,
hull_mass = 40,
fuel_tank_mass = 20,
thruster_fuel_use = 0.0002,
price = 144000,
hyperdrive_class = 3,
}
}
},

static = function(lod)
if lod == 1 then

-- low poly collision mesh, please respect that always, textures on the collision mesh (lowest LOD) kill the framerate, more then anything else, you can have a lot of animated stuff it won't harm as much as this
load_obj('coll.obj')
else
set_material('metal', .3,.35,.33,1,.6,.75,.8,30)
set_material('d_chrome', .4,.43,.45,1,1.2,1.5,1.6,30)
set_material('pit', .65,.63,.6,1,.5,.5,.5,10)
set_material('text',.7,.7,.7,.9,.3,.3,.3,10)
set_material('b_chrome', .63,.7,.83,1,1.2,1.5,1.6,30)
set_material('inside', .1,.1,.08,1,.05,.05,.05,10)
set_material('black', 0,0,0,1,0,0,0,0)
set_material('win', 0,0,.05,.4,1,1,2,100)

-- again, since this model uses no textures it needs a variety of materials, anyways it's cool to have this opportunity instead of only one white default material.
use_material('inside')
load_obj('inside.obj')

use_material('metal')
load_obj('body1.obj')

use_material('rand')
load_obj('body0.obj')

-- restrict details from LOD <= 2
if lod > 2 then
use_material('d_chrome')
load_obj('d_chrome.obj')
-- restrict even more details from LOD <=3
if lod > 3 then
use_material('b_chrome')
load_obj('b_chrome.obj')

use_material('posl_r')
load_obj('posl_r.obj')

use_material('posl_g')
load_obj('posl_l.obj')

use_material('cwarn')
load_obj('cwarn.obj')

use_material('pit')
load_obj('pit.obj')

-- calls the pilot submodels
call_model('pilot_seat',v(5.6,2.744,5.042),v(1,0,0),v(0,1,0),1)
call_model('pilot_seat',v(-5.6,2.744,5.042),v(1,0,0),v(0,1,0),1)
--call_model('pilot_1',v(5.6,2.744,5.042),v(1,0,0),v(0,1,0),1)
call_model('pilot_2',v(-5.6,2.744,5.042),v(1,0,0),v(0,1,0),1)
--call_model('pilot_3_m',v(5.6,2.744,5.042),v(1,0,0),v(0,1,0),1)
call_model('robot_mf',v(8,3.25,5),v(1,0,0),v(0,1,0),1.3)
end
end

-- of course any semi-transparent material has to be called as last else it lets vanish the other parts it covers
use_material('win')
load_obj('wins.obj')
end
end,

dynamic = function(lod)
local rot_f = 3.142*math.clamp(get_animation_position('WHEEL_STATE'),0,0.5)*1.2 -- -.3 , *1.429 for .7

if lod > 1 then
-- changes window material if no cockpit is shown
if lod > 3 then
set_material('win', 0,0,.1,.6,1,1,1.5,100)
else
set_material('win', 0,0,.1,1,1,1,1.5,100)
end

set_material('rand', get_arg_material(0))
use_material('rand')
end

-- calls the UC flaps
call_model('rhoombha_d_flap_r',v(13.073,-3.863,4.554),v(math.cos(rot_f),math.sin(rot_f),0),v(0,0,1),1)

if lod > 1 then
use_material('rand')
end
call_model('rhoombha_d_flap_l',v(-13.073,-3.863,4.554),v(math.cos(-rot_f),math.sin(-rot_f),0),v(0,0,1),1)

-- calls the premodeled Undercarriage only if active
if get_animation_position('WHEEL_STATE') ~= 0 then
call_model('rhoombha_d_uc_r',v(10.328,-2.1,-0.3),v(0.667,0.333,0),v(0,0,1),1)
call_model('rhoombha_d_uc_r',v(-10.328,-2.1,8.3),v(-0.667,0.333,0),v(0,0,-1),1)
call_model('rhoombha_d_uc_l',v(-10.328,-2.1,-0.3),v(0.667,-0.333,0),v(0,0,1),1)
call_model('rhoombha_d_uc_l',v(10.328,-2.1,8.3),v(-0.667,-0.333,0),v(0,0,-1),1)
end

-- calls the scoop mounting
if get_equipment('FUELSCOOP') == 'FUEL_SCOOP' or get_equipment('CARGOSCOOP') == 'CARGO_SCOOP' then
use_material('rand')
call_model('rhoombha_d_scoop',v(0,0,0),v(1,0,0),v(0,1,0),1)
end

if lod > 1 then
-- should animate the "door", but left aside for two reasons, 1. evil to make a animation without a get_animation_position, 2. you won't notice it
use_material('rand')
if get_flight_state() == 'DOCKED' or get_flight_state() == 'LANDED' then
call_model('rhoombha_d_door',v(-9.209,-3.871,-4.846),v(.5,.5,0),v(0,0,1),1)
else
call_model('rhoombha_d_door',v(-9.209,-3.871,-4.846),v(1,0,0),v(0,0,1),1)
end

if lod > 2 then
if lod > 3 then
-- call small equipment only at LOD >3
if get_equipment('ECM') then
use_material('rand')
call_model('rhoombha_d_ecm',v(0,0,0),v(1,0,0),v(0,1,0),1)
end

if get_equipment('LASER', 1) then
call_model('rhoombha_d_gun',v(0,-1.929,-13.065),v(1,0,0),v(0,1,0),1)
end
if get_equipment('LASER', 2) then
call_model('rhoombha_d_r_gun',v(0,0,0),v(1,0,0),v(0,1,0),1)
call_model('rhoombha_d_gun',v(0,-4.122,13.391),v(-1,0,0),v(0,1,0),1)
end
end
-- call bigger equipment at LOD >2
if get_equipment('SCANNER') then
use_material('rand')
call_model('rhoombha_d_scanner',v(0,0,0),v(1,0,0),v(0,1,0),1)
else
call_model('rhoombha_d_cover',v(-12.3,3.038,0),v(1,0,0),v(0,1,0),1)
end

local reg = get_label()
use_material('text')
zbias(1,v(17.2,2.091,5.5),v(.44,.56,0))
text(reg,v(17.2,2.091,5.5),v(.44,.56,0),v(-.035,0,-1),.8, {center = true})
zbias(1,v(-17.2,-2.091,5.5),v(-.44,-.56,0))
text(reg,v(-17.2,-2.091,5.5),v(-.44,-.56,0),v(-.035,0,1),.8, {center = true})
zbias(0)

local M_0 = v(6.4,0,-11.8)
local M_1 = v(-6.4,0,-11.8)
local M_scale = 1.0

if get_equipment('MISSILE',1) == 'MISSILE_UNGUIDED' or get_equipment('MISSILE',3) == 'MISSILE_UNGUIDED' then
call_model('d_unguided',M_0,v(1,0,0),v(0,1,0), M_scale)
elseif get_equipment('MISSILE',1) == 'MISSILE_GUIDED' or get_equipment('MISSILE',3) == 'MISSILE_GUIDED' then
call_model('d_guided',M_0,v(1,0,0),v(0,1,0), M_scale)
elseif get_equipment('MISSILE',1) == 'MISSILE_SMART' or get_equipment('MISSILE',3) == 'MISSILE_SMART' then
call_model('d_smart',M_0,v(1,0,0),v(0,1,0), M_scale)
elseif get_equipment('MISSILE',1) == 'MISSILE_NAVAL' or get_equipment('MISSILE',3) == 'MISSILE_NAVAL' then
call_model('d_naval',M_0,v(1,0,0),v(0,1,0), M_scale)
else
call_model('rhoombha_d_pyl_r',v(0,0,0),v(1,0,0),v(0,1,0),1)
end

if get_equipment('MISSILE',2) == 'MISSILE_UNGUIDED' or get_equipment('MISSILE',4) == 'MISSILE_UNGUIDED' then
call_model('d_unguided',M_1,v(1,0,0),v(0,1,0), M_scale)
elseif get_equipment('MISSILE',2) == 'MISSILE_GUIDED' or get_equipment('MISSILE',4) == 'MISSILE_GUIDED' then
call_model('d_guided',M_1,v(1,0,0),v(0,1,0), M_scale)
elseif get_equipment('MISSILE',2) == 'MISSILE_SMART' or get_equipment('MISSILE',4) == 'MISSILE_SMART' then
call_model('d_smart',M_1,v(1,0,0),v(0,1,0), M_scale)
elseif get_equipment('MISSILE',2) == 'MISSILE_NAVAL' or get_equipment('MISSILE',4) == 'MISSILE_NAVAL' then
call_model('d_naval',M_1,v(1,0,0),v(0,1,0), M_scale)
else
call_model('rhoombha_d_pyl_l',v(0,0,0),v(1,0,0),v(0,1,0),1)
end
end

-- position lights, exclusive for this model, billboard function should be called as last, else it gets overlayed by the following geometry
if ((get_flight_state() == 'DOCKING') or (get_flight_state() == 'FLYING' and get_animation_position('WHEEL_STATE') ~= 0)) then
local lightphase = math.fmod((get_time('SECONDS')*0.75),1)
set_material('posl_g', 0, .85, 0, .5, 1, 1, 1, 100)
set_material('posl_r', .9, 0, 0, .5, 1, 1, 1, 100)
set_material('cwarn', .8, .85, 1, .5, 1, 1, 1, 100)
if lightphase > .1 and lightphase < .3 then
set_material('posl_g', 0, .85, 0, 1, 0, 0, 0, 0, 0, .85, 0)
billboard('smoke.png', 4, v(0,.85,0), { v(-18.3, 1.2, 7) })
elseif lightphase > .3 and lightphase < .5 then
set_material('posl_r', .9, 0, 0, 1, 0, 0, 0, 0, .9, 0, 0)
billboard('smoke.png', 4, v(1,0,0), { v(18.3, 1.2, 7) })
elseif lightphase > .7 and lightphase < .9 then
set_material('cwarn', .8, .85, 1, 1, 0, 0, 0, 0, .7, .75, 1)
billboard('smoke.png', 4, v(.7,.75,1), { v(18.3, -1.2, 7) })
billboard('smoke.png', 4, v(.7,.75,1), { v(-18.3, -1.2, 7) })
end
else
set_material('posl_g', 0, .85, 0, .5, 1, 1, 1, 100)
set_material('posl_r', .9, 0, 0, .5, 1, 1, 1, 100)
set_material('cwarn', .8, .85, 1, .5, 1, 1, 1, 100)
end

call_model('headlight',v(0,-3,-11.9),v(1,0,0),v(0,-1,0),2)

-- unfortunately i have to call the thrusters again in the dynamic part, this since we have the new style, else the "billboard" like thruster flames will vanish by any following geometry
local M_T1 = v(0,0,15.25)
local M_T2 = v(4.8,0,15.25)
local R_T = v(10.354,0,-11.231)
local TF_T = v(10.251,1.883,-10.084)
local TR_T = v(0,5.826,8.018)
local BF_T = v(10.251,-1.883,-10.084)
local BR_T = v(0,-5.826,8.018)
local RF_T = v(11.964,0,-8.340)
local RR_T = v(16.707,0,7.851)
local LF_T = v(-11.964,0,-8.340)
local LR_T = v(-16.707,0,7.851)

thruster(M_T1,v(0,0,1),20, {true})
xref_thruster(M_T2,v(0,0,1),20, {true})
xref_thruster(R_T,v(0,0,-1),10, {true})
xref_thruster(TF_T,v(0,1,0),5)
thruster(TR_T,v(0,1,0),5)
xref_thruster(BF_T,v(0,-1,0),5)
thruster(BR_T,v(0,-1,0),5)
thruster(RF_T,v(1,0,0),5)
thruster(RR_T,v(1,0,0),5)
thruster(LF_T,v(-1,0,0),5)
thruster(LR_T,v(-1,0,0),5)
end
end
})


Quote