Files
CHOMPStation2/code/game/step_triggers.dm
vageyenaman@gmail.com d29e3be8d4 Removes poo. XSI and co. weren't very fond of it, and the last thing I would do is make them uncomfortable and challenge their leadership by keeping poo in.
An experimental lagfix, which removes a couple THOUSAND unnecessary machines from the machine processing list. Please report any unresponsive machinery (as result of this commit) as HIGH PRIORITY issues. I'm not quite sure how much lag this will kill, but I'm confident that it will be at least slightly noticeable.

More work on step_triggers. The escape shuttle should no longer blast things forever and give them infinite momentum.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3370 316c924e-a436-60f5-8080-3fe189b3f50e
2012-03-29 03:53:38 +00:00

112 lines
2.7 KiB
Plaintext

/* Simple object type, calls a proc when "stepped" on by something */
/obj/step_trigger
var/affect_ghosts = 0
var/stopper = 1 // stops throwers
invisibility = 101 // nope cant see this shit
anchored = 1
/obj/step_trigger/proc/Trigger(var/atom/movable/A)
return 0
/obj/step_trigger/HasEntered(H as mob|obj)
..()
if(istype(H, /mob/dead/observer) && !affect_ghosts)
return
Trigger(H)
/* Tosses things in a certain direction */
/obj/step_trigger/thrower
var/direction = SOUTH // the direction of throw
var/tiles = 3 // if 0: forever until atom hits a stopper
var/immobilize = 0 // if nonzero: prevents mobs from moving while they're being flung
var/speed = 1 // delay of movement
var/facedir = 0 // if 1: atom faces the direction of movement
var/nostop = 0 // if 1: will only be stopped by teleporters
var/list/affecting = list()
Trigger(var/atom/movable/A)
var/curtiles = 0
var/stopthrow = 0
for(var/obj/step_trigger/thrower/T in orange(2, src))
if(A in T.affecting)
return
if(ismob(A))
var/mob/M = A
if(immobilize)
M.canmove = 0
affecting.Add(A)
while(A && !stopthrow)
if(tiles)
if(curtiles >= tiles)
break
if(A.z != src.z)
break
curtiles++
sleep(speed)
// Calculate if we should stop the process
if(!nostop)
for(var/obj/step_trigger/T in get_step(A, direction))
if(T.stopper && T != src)
stopthrow = 1
else
for(var/obj/step_trigger/teleporter/T in get_step(A, direction))
if(T.stopper)
stopthrow = 1
var/predir = A.dir
step(A, direction)
if(!facedir)
A.dir = predir
affecting.Remove(A)
if(ismob(A))
var/mob/M = A
if(immobilize)
M.canmove = 1
/* Stops things thrown by a thrower, doesn't do anything */
/obj/step_trigger/stopper
/* Instant teleporter */
/obj/step_trigger/teleporter
var/teleport_x = 0 // teleportation coordinates (if one is null, then no teleport!)
var/teleport_y = 0
var/teleport_z = 0
Trigger(var/atom/movable/A)
if(teleport_x && teleport_y && teleport_z)
A.x = teleport_x
A.y = teleport_y
A.z = teleport_z
/* Random teleporter, teleports atoms to locations ranging from teleport_x - teleport_x_offset, etc */
/obj/step_trigger/teleporter/random
var/teleport_x_offset = 0
var/teleport_y_offset = 0
var/teleport_z_offset = 0
Trigger(var/atom/movable/A)
if(teleport_x && teleport_y && teleport_z)
if(teleport_x_offset && teleport_y_offset && teleport_z_offset)
A.x = rand(teleport_x, teleport_x_offset)
A.y = rand(teleport_y, teleport_y_offset)
A.z = rand(teleport_z, teleport_z_offset)