mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
245 lines
7.1 KiB
Plaintext
245 lines
7.1 KiB
Plaintext
/turf/space
|
|
icon = 'icons/turf/space.dmi'
|
|
name = "\proper space"
|
|
icon_state = "0"
|
|
dynamic_lighting = 0
|
|
plane = SPACE_PLANE
|
|
|
|
temperature = T20C
|
|
thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT
|
|
can_build_into_floor = TRUE
|
|
var/keep_sprite = FALSE
|
|
|
|
/turf/space/Initialize()
|
|
. = ..()
|
|
|
|
if(!keep_sprite)
|
|
icon_state = "white"
|
|
|
|
if(config.starlight)
|
|
update_starlight()
|
|
|
|
toggle_transit() //Add static dust (not passing a dir)
|
|
|
|
/turf/space/proc/toggle_transit(var/direction)
|
|
cut_overlays()
|
|
|
|
if(!direction)
|
|
add_overlay(SSskybox.dust_cache["[((x + y) ^ ~(x * y) + z) % 25]"])
|
|
return
|
|
|
|
if(direction & (NORTH|SOUTH))
|
|
var/x_shift = SSskybox.phase_shift_by_x[src.x % (SSskybox.phase_shift_by_x.len - 1) + 1]
|
|
var/transit_state = ((direction & SOUTH ? world.maxy - src.y : src.y) + x_shift)%15
|
|
add_overlay(SSskybox.speedspace_cache["NS_[transit_state]"])
|
|
else if(direction & (EAST|WEST))
|
|
var/y_shift = SSskybox.phase_shift_by_y[src.y % (SSskybox.phase_shift_by_y.len - 1) + 1]
|
|
var/transit_state = ((direction & WEST ? world.maxx - src.x : src.x) + y_shift)%15
|
|
add_overlay(SSskybox.speedspace_cache["EW_[transit_state]"])
|
|
|
|
for(var/atom/movable/AM in src)
|
|
if (AM.simulated && !AM.anchored)
|
|
AM.throw_at(get_step(src,reverse_direction(direction)), 5, 1)
|
|
|
|
/turf/space/is_space()
|
|
return 1
|
|
|
|
// override for space turfs, since they should never hide anything
|
|
/turf/space/levelupdate()
|
|
for(var/obj/O in src)
|
|
O.hide(0)
|
|
|
|
/turf/space/is_solid_structure()
|
|
return locate(/obj/structure/lattice, src) //counts as solid structure if it has a lattice
|
|
|
|
/turf/space/proc/update_starlight()
|
|
if(locate(/turf/simulated) in orange(src,1))
|
|
set_light(config.starlight)
|
|
else
|
|
set_light(0)
|
|
|
|
/turf/space/attackby(obj/item/C as obj, mob/user as mob)
|
|
|
|
if(istype(C, /obj/item/stack/rods))
|
|
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
|
|
if(L)
|
|
return
|
|
var/obj/item/stack/rods/R = C
|
|
if (R.use(1))
|
|
to_chat(user, "<span class='notice'>Constructing support lattice ...</span>")
|
|
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
|
|
ReplaceWithLattice()
|
|
return
|
|
|
|
if(istype(C, /obj/item/stack/tile/floor))
|
|
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
|
|
if(L)
|
|
var/obj/item/stack/tile/floor/S = C
|
|
if (S.get_amount() < 1)
|
|
return
|
|
qdel(L)
|
|
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
|
|
S.use(1)
|
|
ChangeTurf(/turf/simulated/floor/airless)
|
|
return
|
|
else
|
|
to_chat(user, "<span class='warning'>The plating is going to need some support.</span>")
|
|
|
|
if(istype(C, /obj/item/stack/tile/roofing))
|
|
var/turf/T = GetAbove(src)
|
|
var/obj/item/stack/tile/roofing/R = C
|
|
|
|
// Patch holes in the ceiling
|
|
if(T)
|
|
if(istype(T, /turf/simulated/open) || istype(T, /turf/space))
|
|
// Must be build adjacent to an existing floor/wall, no floating floors
|
|
var/turf/simulated/A = locate(/turf/simulated/floor) in T.CardinalTurfs()
|
|
if(!A)
|
|
A = locate(/turf/simulated/wall) in T.CardinalTurfs()
|
|
if(!A)
|
|
to_chat(user, "<span class='warning'>There's nothing to attach the ceiling to!</span>")
|
|
return
|
|
|
|
if(R.use(1)) // Cost of roofing tiles is 1:1 with cost to place lattice and plating
|
|
T.ReplaceWithLattice()
|
|
T.ChangeTurf(/turf/simulated/floor)
|
|
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
|
|
user.visible_message("<span class='notice'>[user] expands the ceiling.</span>", "<span class='notice'>You expand the ceiling.</span>")
|
|
else
|
|
to_chat(user, "<span class='warning'>There aren't any holes in the ceiling to patch here.</span>")
|
|
return
|
|
// Space shouldn't have weather of the sort planets with atmospheres do.
|
|
// If that's changed, then you'll want to swipe the rest of the roofing code from code/game/turfs/simulated/floor_attackby.dm
|
|
return
|
|
|
|
|
|
// Ported from unstable r355
|
|
|
|
/turf/space/Entered(atom/movable/A as mob|obj)
|
|
if(movement_disabled)
|
|
to_chat(usr, "<span class='warning'>Movement is admin-disabled.</span>") //This is to identify lag problems
|
|
return
|
|
..()
|
|
if ((!(A) || src != A.loc)) return
|
|
|
|
inertial_drift(A)
|
|
|
|
if(ticker && ticker.mode)
|
|
|
|
// Okay, so let's make it so that people can travel z levels but not nuke disks!
|
|
// if(ticker.mode.name == "mercenary") return
|
|
if (A.x <= TRANSITIONEDGE || A.x >= (world.maxx - TRANSITIONEDGE + 1) || A.y <= TRANSITIONEDGE || A.y >= (world.maxy - TRANSITIONEDGE + 1))
|
|
A.touch_map_edge()
|
|
|
|
/turf/space/proc/Sandbox_Spacemove(atom/movable/A as mob|obj)
|
|
var/cur_x
|
|
var/cur_y
|
|
var/next_x
|
|
var/next_y
|
|
var/target_z
|
|
var/list/y_arr
|
|
|
|
if(src.x <= 1)
|
|
if(istype(A, /obj/effect/meteor)||istype(A, /obj/effect/space_dust))
|
|
qdel(A)
|
|
return
|
|
|
|
var/list/cur_pos = src.get_global_map_pos()
|
|
if(!cur_pos) return
|
|
cur_x = cur_pos["x"]
|
|
cur_y = cur_pos["y"]
|
|
next_x = (--cur_x||global_map.len)
|
|
y_arr = global_map[next_x]
|
|
target_z = y_arr[cur_y]
|
|
/*
|
|
//debug
|
|
to_world("Src.z = [src.z] in global map X = [cur_x], Y = [cur_y]")
|
|
to_world("Target Z = [target_z]")
|
|
to_world("Next X = [next_x]")
|
|
//debug
|
|
*/
|
|
if(target_z)
|
|
A.z = target_z
|
|
A.x = world.maxx - 2
|
|
spawn (0)
|
|
if ((A && A.loc))
|
|
A.loc.Entered(A)
|
|
else if (src.x >= world.maxx)
|
|
if(istype(A, /obj/effect/meteor))
|
|
qdel(A)
|
|
return
|
|
|
|
var/list/cur_pos = src.get_global_map_pos()
|
|
if(!cur_pos) return
|
|
cur_x = cur_pos["x"]
|
|
cur_y = cur_pos["y"]
|
|
next_x = (++cur_x > global_map.len ? 1 : cur_x)
|
|
y_arr = global_map[next_x]
|
|
target_z = y_arr[cur_y]
|
|
/*
|
|
//debug
|
|
to_world("Src.z = [src.z] in global map X = [cur_x], Y = [cur_y]")
|
|
to_world("Target Z = [target_z]")
|
|
to_world("Next X = [next_x]")
|
|
//debug
|
|
*/
|
|
if(target_z)
|
|
A.z = target_z
|
|
A.x = 3
|
|
spawn (0)
|
|
if ((A && A.loc))
|
|
A.loc.Entered(A)
|
|
else if (src.y <= 1)
|
|
if(istype(A, /obj/effect/meteor))
|
|
qdel(A)
|
|
return
|
|
var/list/cur_pos = src.get_global_map_pos()
|
|
if(!cur_pos) return
|
|
cur_x = cur_pos["x"]
|
|
cur_y = cur_pos["y"]
|
|
y_arr = global_map[cur_x]
|
|
next_y = (--cur_y||y_arr.len)
|
|
target_z = y_arr[next_y]
|
|
/*
|
|
//debug
|
|
to_world("Src.z = [src.z] in global map X = [cur_x], Y = [cur_y]")
|
|
to_world("Next Y = [next_y]")
|
|
to_world("Target Z = [target_z]")
|
|
//debug
|
|
*/
|
|
if(target_z)
|
|
A.z = target_z
|
|
A.y = world.maxy - 2
|
|
spawn (0)
|
|
if ((A && A.loc))
|
|
A.loc.Entered(A)
|
|
|
|
else if (src.y >= world.maxy)
|
|
if(istype(A, /obj/effect/meteor)||istype(A, /obj/effect/space_dust))
|
|
qdel(A)
|
|
return
|
|
var/list/cur_pos = src.get_global_map_pos()
|
|
if(!cur_pos) return
|
|
cur_x = cur_pos["x"]
|
|
cur_y = cur_pos["y"]
|
|
y_arr = global_map[cur_x]
|
|
next_y = (++cur_y > y_arr.len ? 1 : cur_y)
|
|
target_z = y_arr[next_y]
|
|
/*
|
|
//debug
|
|
to_world("Src.z = [src.z] in global map X = [cur_x], Y = [cur_y]")
|
|
to_world("Next Y = [next_y]")
|
|
to_world("Target Z = [target_z]")
|
|
//debug
|
|
*/
|
|
if(target_z)
|
|
A.z = target_z
|
|
A.y = 3
|
|
spawn (0)
|
|
if ((A && A.loc))
|
|
A.loc.Entered(A)
|
|
return
|
|
|
|
/turf/space/ChangeTurf(var/turf/N, var/tell_universe, var/force_lighting_update, var/preserve_outdoors)
|
|
return ..(N, tell_universe, 1, preserve_outdoors)
|