mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-16 12:07:48 +00:00
Done using this command sed -Ei 's/(\s*\S+)\s*\t+/\1 /g' code/**/*.dm We have countless examples in the codebase with this style gone wrong, and defines and such being on hideously different levels of indentation. Fixing this to keep the alignment involves tainting the blames of code your PR doesn't need to be touching at all. And ultimately, it's hideous. There are some files that this sed makes uglier. I can fix these when they are pointed out, but I believe this is ultimately for the greater good of readability. I'm more concerned with if any strings relied on this. Hi codeowners! Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com>
213 lines
5.6 KiB
Plaintext
213 lines
5.6 KiB
Plaintext
// Basic ladder. By default links to the z-level above/below.
|
|
/obj/structure/ladder
|
|
name = "ladder"
|
|
desc = "A sturdy metal ladder."
|
|
icon = 'icons/obj/structures.dmi'
|
|
icon_state = "ladder11"
|
|
anchored = TRUE
|
|
var/obj/structure/ladder/down //the ladder below this one
|
|
var/obj/structure/ladder/up //the ladder above this one
|
|
var/crafted = FALSE
|
|
obj_flags = CAN_BE_HIT | BLOCK_Z_OUT_DOWN
|
|
|
|
/obj/structure/ladder/Initialize(mapload, obj/structure/ladder/up, obj/structure/ladder/down)
|
|
..()
|
|
if (up)
|
|
src.up = up
|
|
up.down = src
|
|
up.update_icon()
|
|
if (down)
|
|
src.down = down
|
|
down.up = src
|
|
down.update_icon()
|
|
return INITIALIZE_HINT_LATELOAD
|
|
|
|
/obj/structure/ladder/Destroy(force)
|
|
if ((resistance_flags & INDESTRUCTIBLE) && !force)
|
|
return QDEL_HINT_LETMELIVE
|
|
disconnect()
|
|
return ..()
|
|
|
|
/obj/structure/ladder/LateInitialize()
|
|
// By default, discover ladders above and below us vertically
|
|
var/turf/T = get_turf(src)
|
|
var/obj/structure/ladder/L
|
|
|
|
if (!down)
|
|
L = locate() in SSmapping.get_turf_below(T)
|
|
if (L)
|
|
if(crafted == L.crafted)
|
|
down = L
|
|
L.up = src // Don't waste effort looping the other way
|
|
L.update_icon()
|
|
if (!up)
|
|
L = locate() in SSmapping.get_turf_above(T)
|
|
if (L)
|
|
if(crafted == L.crafted)
|
|
up = L
|
|
L.down = src // Don't waste effort looping the other way
|
|
L.update_icon()
|
|
|
|
update_icon()
|
|
|
|
/obj/structure/ladder/proc/disconnect()
|
|
if(up && up.down == src)
|
|
up.down = null
|
|
up.update_icon()
|
|
if(down && down.up == src)
|
|
down.up = null
|
|
down.update_icon()
|
|
up = down = null
|
|
|
|
/obj/structure/ladder/update_icon_state()
|
|
if(up && down)
|
|
icon_state = "ladder11"
|
|
else if(up)
|
|
icon_state = "ladder10"
|
|
else if(down)
|
|
icon_state = "ladder01"
|
|
else //wtf make your ladders properly assholes
|
|
icon_state = "ladder00"
|
|
|
|
/obj/structure/ladder/singularity_pull()
|
|
if (!(resistance_flags & INDESTRUCTIBLE))
|
|
visible_message("<span class='danger'>[src] is torn to pieces by the gravitational pull!</span>")
|
|
qdel(src)
|
|
|
|
/obj/structure/ladder/proc/travel(going_up, mob/user, is_ghost, obj/structure/ladder/ladder)
|
|
if(!is_ghost)
|
|
show_fluff_message(going_up, user)
|
|
ladder.add_fingerprint(user)
|
|
|
|
var/turf/T = get_turf(ladder)
|
|
var/atom/movable/AM
|
|
if(user.pulling)
|
|
AM = user.pulling
|
|
AM.forceMove(T)
|
|
user.forceMove(T)
|
|
if(AM)
|
|
user.start_pulling(AM)
|
|
|
|
//reopening ladder radial menu ahead
|
|
T = get_turf(user)
|
|
var/obj/structure/ladder/ladder_structure = locate() in T
|
|
if (ladder_structure)
|
|
ladder_structure.use(user)
|
|
|
|
/obj/structure/ladder/proc/use(mob/user, is_ghost=FALSE)
|
|
if (!is_ghost && !in_range(src, user))
|
|
return
|
|
|
|
var/list/tool_list = list()
|
|
if (up)
|
|
tool_list["Up"] = image(icon = 'icons/testing/turf_analysis.dmi', icon_state = "red_arrow", dir = NORTH)
|
|
if (down)
|
|
tool_list["Down"] = image(icon = 'icons/testing/turf_analysis.dmi', icon_state = "red_arrow", dir = SOUTH)
|
|
if (!length(tool_list))
|
|
to_chat(user, "<span class='warning'>[src] doesn't seem to lead anywhere!</span>")
|
|
return
|
|
|
|
var/result = show_radial_menu(user, src, tool_list, custom_check = CALLBACK(src, .proc/check_menu, user, is_ghost), require_near = !is_ghost, tooltips = TRUE)
|
|
if (!is_ghost && !in_range(src, user))
|
|
return // nice try
|
|
switch(result)
|
|
if("Up")
|
|
travel(TRUE, user, is_ghost, up)
|
|
if("Down")
|
|
travel(FALSE, user, is_ghost, down)
|
|
if("Cancel")
|
|
return
|
|
|
|
if(!is_ghost)
|
|
add_fingerprint(user)
|
|
|
|
/obj/structure/ladder/proc/check_menu(mob/user, is_ghost)
|
|
if(user.incapacitated() || (!user.Adjacent(src) && !is_ghost))
|
|
return FALSE
|
|
return TRUE
|
|
|
|
/obj/structure/ladder/attack_hand(mob/user)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
use(user)
|
|
|
|
/obj/structure/ladder/attack_paw(mob/user)
|
|
return use(user)
|
|
|
|
/obj/structure/ladder/attack_alien(mob/user)
|
|
return use(user)
|
|
|
|
/obj/structure/ladder/attack_larva(mob/user)
|
|
return use(user)
|
|
|
|
/obj/structure/ladder/attack_animal(mob/user)
|
|
return use(user)
|
|
|
|
/obj/structure/ladder/attack_slime(mob/user)
|
|
return use(user)
|
|
|
|
/obj/structure/ladder/attackby(obj/item/W, mob/user, params)
|
|
return use(user)
|
|
|
|
/obj/structure/ladder/attack_robot(mob/living/silicon/robot/R)
|
|
if(R.Adjacent(src))
|
|
return use(R)
|
|
|
|
//ATTACK GHOST IGNORING PARENT RETURN VALUE
|
|
/obj/structure/ladder/attack_ghost(mob/dead/observer/user)
|
|
use(user, TRUE)
|
|
return ..()
|
|
|
|
/obj/structure/ladder/proc/show_fluff_message(going_up, mob/user)
|
|
if(going_up)
|
|
user.visible_message("<span class='notice'>[user] climbs up [src].</span>", "<span class='notice'>You climb up [src].</span>")
|
|
else
|
|
user.visible_message("<span class='notice'>[user] climbs down [src].</span>", "<span class='notice'>You climb down [src].</span>")
|
|
|
|
|
|
// Indestructible away mission ladders which link based on a mapped ID and height value rather than X/Y/Z.
|
|
/obj/structure/ladder/unbreakable
|
|
name = "sturdy ladder"
|
|
desc = "An extremely sturdy metal ladder."
|
|
resistance_flags = INDESTRUCTIBLE
|
|
var/id
|
|
var/height = 0 // higher numbers are considered physically higher
|
|
|
|
/obj/structure/ladder/unbreakable/Initialize()
|
|
GLOB.ladders += src
|
|
return ..()
|
|
|
|
/obj/structure/ladder/unbreakable/Destroy()
|
|
. = ..()
|
|
if (. != QDEL_HINT_LETMELIVE)
|
|
GLOB.ladders -= src
|
|
|
|
/obj/structure/ladder/unbreakable/LateInitialize()
|
|
// Override the parent to find ladders based on being height-linked
|
|
if (!id || (up && down))
|
|
update_icon()
|
|
return
|
|
|
|
for (var/O in GLOB.ladders)
|
|
var/obj/structure/ladder/unbreakable/L = O
|
|
if (L.id != id)
|
|
continue // not one of our pals
|
|
if (!down && L.height == height - 1)
|
|
down = L
|
|
L.up = src
|
|
L.update_icon()
|
|
if (up)
|
|
break // break if both our connections are filled
|
|
else if (!up && L.height == height + 1)
|
|
up = L
|
|
L.down = src
|
|
L.update_icon()
|
|
if (down)
|
|
break // break if both our connections are filled
|
|
|
|
update_icon()
|
|
|
|
/obj/structure/ladder/crafted
|
|
crafted = TRUE
|