mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
Largely ported from the work done at Baystation in https://github.com/Baystation12/Baystation12/pull/17460 and later commits. - Shuttles no longer require a separate area for each location they jump to. Instead destinations are indicated by landmark objects, which are not necessarily exclusive to that shuttle. This means that more than one shuttle could use the same docking port (not at the same time of course). - Enhanced shuttle control computers to use nanoui if they didn't. - Organizes shuttle datum code a bit better so there is less re-inventing the wheel in subtypes. - Allows the possibility of shuttles (or destinations) that start on late-loaded maps. - Deprecate the "extra" shuttle areas that are no longer needed and update shuttle areas in unit tests This all required a bit of infrastructure improvements. - ChangeArea proc, for changing the area of a turf. - Fixed lighting overlays actually being able to be destroyed. - Added a few utility macros and procs. - Added "turf translation" procs which are like move_contents_to but more flexible.
222 lines
6.2 KiB
Plaintext
222 lines
6.2 KiB
Plaintext
/turf/space
|
|
icon = 'icons/turf/space.dmi'
|
|
name = "\proper space"
|
|
icon_state = "0"
|
|
dynamic_lighting = 0
|
|
|
|
temperature = T20C
|
|
thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT
|
|
can_build_into_floor = TRUE
|
|
var/keep_sprite = FALSE
|
|
// heat_capacity = 700000 No.
|
|
|
|
/turf/space/Initialize()
|
|
. = ..()
|
|
if(!keep_sprite)
|
|
icon_state = "[((x + y) ^ ~(x * y) + z) % 25]"
|
|
update_starlight()
|
|
|
|
/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(!config.starlight)
|
|
return
|
|
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)
|