Files
kiwistation/code/game/turfs/space/space.dm
T
2016-01-30 19:44:20 +00:00

138 lines
3.7 KiB
Plaintext

/turf/space
icon = 'icons/turf/space.dmi'
name = "\proper space"
icon_state = "0"
intact = 0
temperature = TCMB
thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT
heat_capacity = 700000
var/destination_z
var/destination_x
var/destination_y
/turf/space/New()
if(!istype(src, /turf/space/transit))
icon_state = SPACE_ICON_STATE
/turf/space/Destroy()
return QDEL_HINT_LETMELIVE
/turf/space/proc/update_starlight()
if(config)
if(config.starlight)
for(var/turf/simulated/T in RANGE_TURFS(1,src)) //RANGE_TURFS is in code\__HELPERS\game.dm
SetLuminosity(4,1)
return
SetLuminosity(0)
/turf/space/attack_paw(mob/user)
return src.attack_hand(user)
/turf/space/attackby(obj/item/C, mob/user, params)
..()
if(istype(C, /obj/item/stack/rods))
var/obj/item/stack/rods/R = C
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
var/obj/structure/lattice/catwalk/W = locate(/obj/structure/lattice/catwalk, src)
if(W)
user << "<span class='warning'>There is already a catwalk here!</span>"
return
if(L)
if(R.use(1))
user << "<span class='notice'>You begin constructing catwalk...</span>"
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
qdel(L)
ReplaceWithCatwalk()
else
user << "<span class='warning'>You need two rods to build a catwalk!</span>"
return
if(R.use(1))
user << "<span class='notice'>Constructing support lattice...</span>"
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
ReplaceWithLattice()
else
user << "<span class='warning'>You need one rod to build a lattice.</span>"
return
if(istype(C, /obj/item/stack/tile/plasteel))
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
if(L)
var/obj/item/stack/tile/plasteel/S = C
if(S.use(1))
qdel(L)
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
user << "<span class='notice'>You build a floor.</span>"
ChangeTurf(/turf/simulated/floor/plating)
else
user << "<span class='warning'>You need one floor tile to build a floor!</span>"
else
user << "<span class='warning'>The plating is going to need some support! Place metal rods first.</span>"
/turf/space/Entered(atom/movable/A)
..()
if ((!(A) || src != A.loc))
return
if(destination_z)
A.x = destination_x
A.y = destination_y
A.z = destination_z
if(isliving(A))
var/mob/living/L = A
if(L.pulling)
var/turf/T = get_step(L.loc,turn(A.dir, 180))
L.pulling.loc = T
//now we're on the new z_level, proceed the space drifting
sleep(0)//Let a diagonal move finish, if necessary
A.newtonian_move(A.inertia_dir)
/turf/space/proc/Sandbox_Spacemove(atom/movable/A)
var/cur_x
var/cur_y
var/next_x = src.x
var/next_y = src.y
var/target_z
var/list/y_arr
var/list/cur_pos = src.get_global_map_pos()
if(!cur_pos)
return
cur_x = cur_pos["x"]
cur_y = cur_pos["y"]
if(src.x <= 1)
next_x = (--cur_x||global_map.len)
y_arr = global_map[next_x]
target_z = y_arr[cur_y]
next_x = world.maxx - 2
else if (src.x >= world.maxx)
next_x = (++cur_x > global_map.len ? 1 : cur_x)
y_arr = global_map[next_x]
target_z = y_arr[cur_y]
next_x = 3
else if (src.y <= 1)
y_arr = global_map[cur_x]
next_y = (--cur_y||y_arr.len)
target_z = y_arr[next_y]
next_y = world.maxy - 2
else if (src.y >= world.maxy)
y_arr = global_map[cur_x]
next_y = (++cur_y > y_arr.len ? 1 : cur_y)
target_z = y_arr[next_y]
next_y = 3
var/turf/T = locate(next_x, next_y, target_z)
A.Move(T)
/turf/space/handle_slip()
return
/turf/space/singularity_act()
return
/turf/space/can_have_cabling()
if(locate(/obj/structure/lattice/catwalk, src))
return 1
return 0