Files
Polaris/code/_helpers/atom_movables.dm
Mechoid 7b018e3281 Upkeep on Mech & Cliff code. (#8946)
* Upkeep on Mech code.

Assembly Mines fixed, they do not spawn with an explosive payload from parent.

Vehicles no longer ignore cliffs.

Exosuits no longer ignore cliffs.

Objects can fall off cliffs. Objects with a buckled person will hurt the person. (Rollerbeds looking at you.)

Jumpjets added to allow planetary traversal, primarily useful upon the Serenity, Hoverpods, and Marauders (adminspawn). When toggled, they allow movement vertically, and prevent falling through open spaces. When used as the active equipment, it will launch the exosuit toward the target turf. When not on one of the above mentioned suits, it will cause a small explosion on launch, damaging the exosuit and anything directly nearby.

* Fighters are flying.

* Revert step delay floor adjustment. Flat strafing modifier of 1/5th of a second should be enough.

* Correction and Tweak.

* Fix stupidity.
2023-03-04 11:36:18 -08:00

44 lines
1.5 KiB
Plaintext

/proc/get_turf_pixel(atom/movable/AM)
if(!istype(AM))
return
//Find AM's matrix so we can use it's X/Y pixel shifts
var/matrix/M = matrix(AM.transform)
var/pixel_x_offset = AM.pixel_x + M.get_x_shift()
var/pixel_y_offset = AM.pixel_y + M.get_y_shift()
//Irregular objects
if(AM.bound_height != world.icon_size || AM.bound_width != world.icon_size)
var/icon/AMicon = icon(AM.icon, AM.icon_state)
pixel_x_offset += ((AMicon.Width()/world.icon_size)-1)*(world.icon_size*0.5)
pixel_y_offset += ((AMicon.Height()/world.icon_size)-1)*(world.icon_size*0.5)
qdel(AMicon)
//DY and DX
var/rough_x = round(round(pixel_x_offset,world.icon_size)/world.icon_size)
var/rough_y = round(round(pixel_y_offset,world.icon_size)/world.icon_size)
//Find coordinates
var/turf/T = get_turf(AM) //use AM's turfs, as it's coords are the same as AM's AND AM's coords are lost if it is inside another atom
var/final_x = T.x + rough_x
var/final_y = T.y + rough_y
if(final_x || final_y)
return locate(final_x, final_y, T.z)
// Walks up the loc tree until it finds a holder of the given holder_type
/proc/get_holder_of_type(atom/A, holder_type)
if(!istype(A)) return
for(A, A && !istype(A, holder_type), A=A.loc);
return A
/atom/movable/proc/throw_at_random(var/include_own_turf, var/maxrange, var/speed, var/arc)
var/list/turfs = trange(maxrange, src)
if(!maxrange)
maxrange = 1
if(!include_own_turf)
turfs -= get_turf(src)
src.throw_at(pick(turfs), maxrange, speed, src, arc)