Skip to content

Commit

Permalink
use attribute syntax rather than a method call to access lua vector x…
Browse files Browse the repository at this point in the history
…/y/z
  • Loading branch information
johnbartholomew committed May 5, 2012
1 parent 6c911ac commit 4d288eb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
26 changes: 13 additions & 13 deletions data/models/spacestations.lua
Expand Up @@ -591,21 +591,21 @@ define_model('mushroom_station_2', {
ship_dock_anim = function(port, stage, t, from, ship_aabb)
local port_pos = { v(-100,100,0), v(100,100,0) }
if stage == 2 then
return { vlerp(t, from, port_pos[port] - v(0,ship_aabb.min:y(),0)), v(1,0,0), v(0,1,0) }
return { vlerp(t, from, port_pos[port] - v(0,ship_aabb.min.y,0)), v(1,0,0), v(0,1,0) }
elseif stage == 3 then
return { vlerp(t, from, port_pos[port] + v(0,-75,0) - v(0,ship_aabb.min:y(),0)), v(1,0,0), v(0,1,0) }
return { vlerp(t, from, port_pos[port] + v(0,-75,0) - v(0,ship_aabb.min.y,0)), v(1,0,0), v(0,1,0) }
elseif stage == 4 or stage == -1 then
return { port_pos[port] + v(0,-75,0) - v(0,ship_aabb.min:y(),0), v(1,0,0), v(0,1,0) }
return { port_pos[port] + v(0,-75,0) - v(0,ship_aabb.min.y,0), v(1,0,0), v(0,1,0) }
elseif stage == -2 then
return { vlerp(t, from, port_pos[port] + v(0,1,0) - v(0,ship_aabb.min:y(),0)), v(1,0,0), v(0,1,0) }
return { vlerp(t, from, port_pos[port] + v(0,1,0) - v(0,ship_aabb.min.y,0)), v(1,0,0), v(0,1,0) }
end
end,
ship_approach_waypoints = function(port, stage)
local port_pos = { v(-100,100,0), v(100,100,0) }
if stage == 1 then
return { v(port_pos[port]:x(), port_pos[port]:y()+10000, port_pos[port]:z()), v(1,0,0), v(0,1,0) }
return { v(port_pos[port].x, port_pos[port].y+10000, port_pos[port].z), v(1,0,0), v(0,1,0) }
elseif stage == 2 then
return { v(port_pos[port]:x(), port_pos[port]:y(), port_pos[port]:z()), v(1,0,0), v(0,1,0) }
return { v(port_pos[port].x, port_pos[port].y, port_pos[port].z), v(1,0,0), v(0,1,0) }
end
end,
},
Expand Down Expand Up @@ -697,21 +697,21 @@ define_model('mushroom_station_4', {
ship_dock_anim = function(port, stage, t, from, ship_aabb)
local port_pos = { v(-100,100,0), v(100,100,0), v(-100,100,200), v(100,100,200)}
if stage == 2 then
return { vlerp(t, from, port_pos[port] - v(0,ship_aabb.min:y(),0)), v(1,0,0), v(0,1,0) }
return { vlerp(t, from, port_pos[port] - v(0,ship_aabb.min.y,0)), v(1,0,0), v(0,1,0) }
elseif stage == 3 then
return { vlerp(t, from, port_pos[port] + v(0,-75,0) - v(0,ship_aabb.min:y(),0)), v(1,0,0), v(0,1,0) }
return { vlerp(t, from, port_pos[port] + v(0,-75,0) - v(0,ship_aabb.min.y,0)), v(1,0,0), v(0,1,0) }
elseif stage == 4 or stage == -1 then
return { port_pos[port] + v(0,-75,0) - v(0,ship_aabb.min:y(),0), v(1,0,0), v(0,1,0) }
return { port_pos[port] + v(0,-75,0) - v(0,ship_aabb.min.y,0), v(1,0,0), v(0,1,0) }
elseif stage == -2 then
return { vlerp(t, from, port_pos[port] + v(0,1,0) - v(0,ship_aabb.min:y(),0)), v(1,0,0), v(0,1,0) }
return { vlerp(t, from, port_pos[port] + v(0,1,0) - v(0,ship_aabb.min.y,0)), v(1,0,0), v(0,1,0) }
end
end,
ship_approach_waypoints = function(port, stage)
local port_pos = { v(-100,100,0), v(100,100,0), v(-100,100,200), v(100,100,200)}
if stage == 1 then
return { v(port_pos[port]:x(), port_pos[port]:y()+10000, port_pos[port]:z()), v(1,0,0), v(0,1,0) }
return { v(port_pos[port].x, port_pos[port].y+10000, port_pos[port].z), v(1,0,0), v(0,1,0) }
elseif stage == 2 then
return { v(port_pos[port]:x(), port_pos[port]:y(), port_pos[port]:z()), v(1,0,0), v(0,1,0) }
return { v(port_pos[port].x, port_pos[port].y, port_pos[port].z), v(1,0,0), v(0,1,0) }
end
end,
},
Expand Down Expand Up @@ -1250,7 +1250,7 @@ define_model('basic_groundstation', {
ship_dock_anim = function(port, stage, t, from, ship_aabb)
local port_pos = { v(-100,10,50), v(100,10,50) }
if stage == 2 then
return { vlerp(t, from, port_pos[port] - v(0,ship_aabb.min:y(),0)), v(1,0,0), v(0,1,0) }
return { vlerp(t, from, port_pos[port] - v(0,ship_aabb.min.y,0)), v(1,0,0), v(0,1,0) }
end
end,
},
Expand Down
24 changes: 12 additions & 12 deletions data/models/stations/ground_stations.lua
Expand Up @@ -76,15 +76,15 @@ define_model('ground_station_1', {
ship_dock_anim = function(port, stage, t, from, ship_aabb)
local port_pos = { v(-150,50,0) }
if stage == 2 then
return { vlerp(t, from, port_pos[port] - v(0,ship_aabb.min:y(),0)), v(1,0,0), v(0,1,0) }
return { vlerp(t, from, port_pos[port] - v(0,ship_aabb.min.y,0)), v(1,0,0), v(0,1,0) }
end
end,
ship_approach_waypoints = function(port, stage)
local port_pos = { v(-150,50,0) }
if stage == 1 then
return { v(port_pos[port]:x(), port_pos[port]:y()+1000, port_pos[port]:z()), v(1,0,0), v(0,1,0) }
return { v(port_pos[port].x, port_pos[port].y+1000, port_pos[port].z), v(1,0,0), v(0,1,0) }
elseif stage == 2 then
return { v(port_pos[port]:x(), port_pos[port]:y(), port_pos[port]:z()), v(1,0,0), v(0,1,0) }
return { v(port_pos[port].x, port_pos[port].y, port_pos[port].z), v(1,0,0), v(0,1,0) }
end
end,
},
Expand All @@ -109,15 +109,15 @@ define_model('ground_station_2', {
ship_dock_anim = function(port, stage, t, from, ship_aabb)
local port_pos = { v(-150,50,0), v(150,50,0) }
if stage == 2 then
return { vlerp(t, from, port_pos[port] - v(0,ship_aabb.min:y(),0)), v(1,0,0), v(0,1,0) }
return { vlerp(t, from, port_pos[port] - v(0,ship_aabb.min.y,0)), v(1,0,0), v(0,1,0) }
end
end,
ship_approach_waypoints = function(port, stage)
local port_pos = { v(-150,50,0), v(150,50,0) }
if stage == 1 then
return { v(port_pos[port]:x(), port_pos[port]:y()+1000, port_pos[port]:z()), v(1,0,0), v(0,1,0) }
return { v(port_pos[port].x, port_pos[port].y+1000, port_pos[port].z), v(1,0,0), v(0,1,0) }
elseif stage == 2 then
return { v(port_pos[port]:x(), port_pos[port]:y(), port_pos[port]:z()), v(1,0,0), v(0,1,0) }
return { v(port_pos[port].x, port_pos[port].y, port_pos[port].z), v(1,0,0), v(0,1,0) }
end
end,
},
Expand All @@ -143,15 +143,15 @@ define_model('ground_station_3', {
ship_dock_anim = function(port, stage, t, from, ship_aabb)
local port_pos = { v(-150,50,0), v(150,50,0), v(0,50,-150) }
if stage == 2 then
return { vlerp(t, from, port_pos[port] - v(0,ship_aabb.min:y(),0)), v(1,0,0), v(0,1,0) }
return { vlerp(t, from, port_pos[port] - v(0,ship_aabb.min.y,0)), v(1,0,0), v(0,1,0) }
end
end,
ship_approach_waypoints = function(port, stage)
local port_pos = { v(-150,50,0), v(150,50,0), v(0,50,-150) }
if stage == 1 then
return { v(port_pos[port]:x(), port_pos[port]:y()+1000, port_pos[port]:z()), v(1,0,0), v(0,1,0) }
return { v(port_pos[port].x, port_pos[port].y+1000, port_pos[port].z), v(1,0,0), v(0,1,0) }
elseif stage == 2 then
return { v(port_pos[port]:x(), port_pos[port]:y(), port_pos[port]:z()), v(1,0,0), v(0,1,0) }
return { v(port_pos[port].x, port_pos[port].y, port_pos[port].z), v(1,0,0), v(0,1,0) }
end
end,
},
Expand All @@ -177,15 +177,15 @@ define_model('ground_station_4', {
ship_dock_anim = function(port, stage, t, from, ship_aabb)
local port_pos = { v(-150,50,0), v(150,50,0), v(0,50,-150), v(0,50,150) }
if stage == 2 then
return { vlerp(t, from, port_pos[port] - v(0,ship_aabb.min:y(),0)), v(1,0,0), v(0,1,0) }
return { vlerp(t, from, port_pos[port] - v(0,ship_aabb.min.y,0)), v(1,0,0), v(0,1,0) }
end
end,
ship_approach_waypoints = function(port, stage)
local port_pos = { v(-150,50,0), v(150,50,0), v(0,50,-150), v(0,50,150) }
if stage == 1 then
return { v(port_pos[port]:x(), port_pos[port]:y()+1000, port_pos[port]:z()), v(1,0,0), v(0,1,0) }
return { v(port_pos[port].x, port_pos[port].y+1000, port_pos[port].z), v(1,0,0), v(0,1,0) }
elseif stage == 2 then
return { v(port_pos[port]:x(), port_pos[port]:y(), port_pos[port]:z()), v(1,0,0), v(0,1,0) }
return { v(port_pos[port].x, port_pos[port].y, port_pos[port].z), v(1,0,0), v(0,1,0) }
end
end,
},
Expand Down
6 changes: 3 additions & 3 deletions data/pimodels.lua
Expand Up @@ -9,9 +9,9 @@ math.clamp = function(v, min, max)
end

function cuboid(pos, size)
local sx = v(size:x(),0,0)
local sy = v(0,size:y(),0)
local sz = v(0,0,size:z())
local sx = v(size.x,0,0)
local sy = v(0,size.y,0)
local sz = v(0,0,size.z)
quad(pos, pos+sy, pos+sy+sx, pos+sx)
quad(pos+sy, pos+sy+sz, pos+sy+sx+sz, pos+sy+sx)
quad(pos, pos+sz, pos+sz+sy, pos+sy)
Expand Down

0 comments on commit 4d288eb

Please sign in to comment.