Files
vgstation13/code/game/atoms_movable.dm
johnsonmt88@gmail.com c7947ef236 File restructuring: ohgodihopenothingbroke edition.
All /world/ stuff that I've found is now in code/world.dm instead of being scattered throughout the code in 6-7 files.

*****IMPORTANT*****
This means that hub.dm is now part of world.dm. Server hosts using the hub will likely have to redo the hub/password variables!

Again, that stuff is now located in code/world.dm
*******************

The tester list has been removed as it is not in use.

/code/defines
- Moved atom.dm code into /code/game/atom.dm and atom_movable.dm
- Moved hub.dm code into /code/world.dm
- Moved the /defines/tanning into objects/item/sheets/leather.dm
- Moved /defines/area/ into game/area/
- Moved turf.dm code into the code/game/turfs folder and divided it up into meaningful places

A lot of the files in /code/game were placed in new areas since they really didn't have a reason to be there.
- algorithm.dm: 
- - The world stuff is in world.dm. 
- - countJob() and AutoUpdateTK() were removed entirely (unused).
- - AutoUpdateAI() is now in /mob/living/silicon/ai.dm

- atom_procs.dm was split into atom.dm and atom_movable.dm

- cellautomata.dm
- - World stuff was moved into world.dm
- - Atom stuff was moved into atom.dm and atom_movable.dm
- - Atom verbs were moved into code/game/verbs/atom_verbs.dm

- chemistry.dm
- - Beaker box code was moved into storage/misc.dm
- - The trash can and 'alechemy' paper were removed. (unused)

- Landmarks.dm was moved into /objects/effects/landmarks.dm

- prisonshuttle.dm, specops_shuttle.dm, syndicate_shuttle.dm and syndicate_specops_shuttle.dm have been moved into game/machinery/computer/

- status.dm and topic.dm code were moved into world.dm

- step_triggers.dm are now in objects/effects/step_triggers.dm

- throwing.dm was split into appropriate files (carbon mob code, atom_movable.dm, ect)

- vote.dm is now in code/datums

/code/game/asteroid was split up.
- turf.dm was moved into game/turfs/simulated/asteroid.dm
- artifacts were split up
- - Wish granter is now in game/machinery
- - The stealth box is gone (unused)
- - The list of 'space suprises' was moved into astroid.dm
- asteroid.dm, being the only file left, was moved into /code/game


and finally...
modules/mob/organs files are now in code/datums/organs

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4659 316c924e-a436-60f5-8080-3fe189b3f50e
2012-09-08 22:11:02 +00:00

179 lines
4.9 KiB
Plaintext

/atom/movable
layer = 3
var/last_move = null
var/anchored = 0
// var/elevation = 2 - not used anywhere
var/move_speed = 10
var/l_move_time = 1
var/m_flag = 1
var/throwing = 0
var/throw_speed = 2
var/throw_range = 7
var/moved_recently = 0
var/mob/pulledby = null
/atom/movable/Move()
var/atom/A = src.loc
. = ..()
src.move_speed = world.timeofday - src.l_move_time
src.l_move_time = world.timeofday
src.m_flag = 1
if ((A != src.loc && A && A.z == src.z))
src.last_move = get_dir(A, src.loc)
return
/atom/movable/Bump(var/atom/A as mob|obj|turf|area, yes)
if(src.throwing)
src.throw_impact(A)
src.throwing = 0
spawn( 0 )
if ((A && yes))
A.last_bumped = world.time
A.Bumped(src)
return
..()
return
/atom/movable/proc/forceMove(atom/destination)
if(destination)
if(loc)
loc.Exited(src)
loc = destination
loc.Entered(src)
return 1
return 0
/atom/movable/proc/hit_check()
if(src.throwing)
for(var/atom/A in get_turf(src))
if(A == src) continue
if(istype(A,/mob/living))
if(A:lying) continue
src.throw_impact(A)
if(src.throwing == 1)
src.throwing = 0
if(isobj(A))
if(A.density && !A.throwpass) // **TODO: Better behaviour for windows which are dense, but shouldn't always stop movement
src.throw_impact(A)
src.throwing = 0
/atom/movable/proc/throw_at(atom/target, range, speed)
if(!target || !src) return 0
//use a modified version of Bresenham's algorithm to get from the atom's current position to that of the target
src.throwing = 1
if(usr)
if((HULK in usr.mutations) || (SUPRSTR in usr.augmentations))
src.throwing = 2 // really strong throw!
var/dist_x = abs(target.x - src.x)
var/dist_y = abs(target.y - src.y)
var/dx
if (target.x > src.x)
dx = EAST
else
dx = WEST
var/dy
if (target.y > src.y)
dy = NORTH
else
dy = SOUTH
var/dist_travelled = 0
var/dist_since_sleep = 0
var/area/a = get_area(src.loc)
if(dist_x > dist_y)
var/error = dist_x/2 - dist_y
while(src && target &&((((src.x < target.x && dx == EAST) || (src.x > target.x && dx == WEST)) && dist_travelled < range) || (a.has_gravity == 0) || istype(src.loc, /turf/space)) && src.throwing && istype(src.loc, /turf))
// only stop when we've gone the whole distance (or max throw range) and are on a non-space tile, or hit something, or hit the end of the map, or someone picks it up
if(error < 0)
var/atom/step = get_step(src, dy)
if(!step) // going off the edge of the map makes get_step return null, don't let things go off the edge
break
src.Move(step)
hit_check()
error += dist_x
dist_travelled++
dist_since_sleep++
if(dist_since_sleep >= speed)
dist_since_sleep = 0
sleep(1)
else
var/atom/step = get_step(src, dx)
if(!step) // going off the edge of the map makes get_step return null, don't let things go off the edge
break
src.Move(step)
hit_check()
error -= dist_y
dist_travelled++
dist_since_sleep++
if(dist_since_sleep >= speed)
dist_since_sleep = 0
sleep(1)
a = get_area(src.loc)
else
var/error = dist_y/2 - dist_x
while(src && target &&((((src.y < target.y && dy == NORTH) || (src.y > target.y && dy == SOUTH)) && dist_travelled < range) || (a.has_gravity == 0) || istype(src.loc, /turf/space)) && src.throwing && istype(src.loc, /turf))
// only stop when we've gone the whole distance (or max throw range) and are on a non-space tile, or hit something, or hit the end of the map, or someone picks it up
if(error < 0)
var/atom/step = get_step(src, dx)
if(!step) // going off the edge of the map makes get_step return null, don't let things go off the edge
break
src.Move(step)
hit_check()
error += dist_y
dist_travelled++
dist_since_sleep++
if(dist_since_sleep >= speed)
dist_since_sleep = 0
sleep(1)
else
var/atom/step = get_step(src, dy)
if(!step) // going off the edge of the map makes get_step return null, don't let things go off the edge
break
src.Move(step)
hit_check()
error -= dist_x
dist_travelled++
dist_since_sleep++
if(dist_since_sleep >= speed)
dist_since_sleep = 0
sleep(1)
a = get_area(src.loc)
//done throwing, either because it hit something or it finished moving
src.throwing = 0
if(isobj(src)) src:throw_impact(get_turf(src))
//Overlays
/atom/movable/overlay
var/atom/master = null
anchored = 1
/atom/movable/overlay/New()
for(var/x in src.verbs)
src.verbs -= x
return
/atom/movable/overlay/attackby(a, b)
if (src.master)
return src.master.attackby(a, b)
return
/atom/movable/overlay/attack_paw(a, b, c)
if (src.master)
return src.master.attack_paw(a, b, c)
return
/atom/movable/overlay/attack_hand(a, b, c)
if (src.master)
return src.master.attack_hand(a, b, c)
return