mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-11 15:14:27 +01:00
Merge pull request #12105 from Fox-McCloud/ports-tendril-loot
Adds Book of Babel and Jacob's Ladder
This commit is contained in:
@@ -1,33 +1,59 @@
|
||||
// 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 = 1
|
||||
var/id = null
|
||||
var/height = 0 //the 'height' of the ladder. higher numbers are considered physically higher
|
||||
var/obj/structure/ladder/down = null //the ladder below this one
|
||||
var/obj/structure/ladder/up = null //the ladder above this one
|
||||
var/use_verb = "climbs"
|
||||
anchored = TRUE
|
||||
var/obj/structure/ladder/down //the ladder below this one
|
||||
var/obj/structure/ladder/up //the ladder above this one
|
||||
var/use_verb = "climb"
|
||||
|
||||
/obj/structure/ladder/New()
|
||||
spawn(8)
|
||||
for(var/obj/structure/ladder/L in world)
|
||||
if(L.id == id)
|
||||
if(L.height == (height - 1))
|
||||
down = L
|
||||
if(isnull(L.up))
|
||||
L.up = src
|
||||
continue
|
||||
if(L.height == (height + 1))
|
||||
up = L
|
||||
if(isnull(L.down))
|
||||
L.down = src
|
||||
continue
|
||||
/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
|
||||
|
||||
if(up && down) //if both our connections are filled
|
||||
break
|
||||
update_icon()
|
||||
/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)
|
||||
|
||||
if(!down)
|
||||
for(var/obj/structure/ladder/L in locate(T.x, T.y, T.z - 1))
|
||||
down = L
|
||||
L.up = src // Don't waste effort looping the other way
|
||||
L.update_icon()
|
||||
break
|
||||
if(!up)
|
||||
for (var/obj/structure/ladder/L in locate(T.x, T.y, T.z + 1))
|
||||
up = L
|
||||
L.down = src // Don't waste effort looping the other way
|
||||
L.update_icon()
|
||||
break
|
||||
|
||||
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()
|
||||
if(up && down)
|
||||
@@ -42,61 +68,134 @@
|
||||
else //wtf make your ladders properly assholes
|
||||
icon_state = "ladder00"
|
||||
|
||||
/obj/structure/ladder/attack_hand(mob/user as mob)
|
||||
/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)
|
||||
|
||||
/obj/structure/ladder/proc/use(mob/user, is_ghost = FALSE)
|
||||
if(!is_ghost && !in_range(src, user))
|
||||
return
|
||||
|
||||
if(up && down)
|
||||
switch( alert("Go up or down the ladder?", "Ladder", "Up", "Down", "Cancel") )
|
||||
var/result = alert("Go up or down [src]?", "[name]", "Up", "Down", "Cancel")
|
||||
if (!is_ghost && !in_range(src, user))
|
||||
return // nice try
|
||||
switch(result)
|
||||
if("Up")
|
||||
user.visible_message("<span class='notice'>[user] climbs up \the [src]!</span>", \
|
||||
"<span class='notice'>You climb up \the [src]!</span>")
|
||||
user.forceMove(get_turf(up))
|
||||
up.add_fingerprint(user)
|
||||
travel(TRUE, user, is_ghost, up)
|
||||
if("Down")
|
||||
user.visible_message("<span class='notice'>[user] climbs down \the [src]!</span>", \
|
||||
"<span class='notice'>You climb down \the [src]!</span>")
|
||||
user.forceMove(get_turf(down))
|
||||
down.add_fingerprint(user)
|
||||
travel(FALSE, user, is_ghost, down)
|
||||
if("Cancel")
|
||||
return
|
||||
|
||||
else if(up)
|
||||
user.visible_message("<span class='notice'>[user] climbs up \the [src]!</span>", \
|
||||
"<span class='notice'>You climb up \the [src]!</span>")
|
||||
user.forceMove(get_turf(up))
|
||||
up.add_fingerprint(user)
|
||||
|
||||
travel(TRUE, user, is_ghost, up)
|
||||
else if(down)
|
||||
user.visible_message("<span class='notice'>[user] climbs down \the [src]!</span>", \
|
||||
"<span class='notice'>You climb down \the [src]!</span>")
|
||||
user.forceMove(get_turf(down))
|
||||
down.add_fingerprint(user)
|
||||
travel(FALSE, user, is_ghost, down)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>[src] doesn't seem to lead anywhere!</span>")
|
||||
|
||||
add_fingerprint(user)
|
||||
if(!is_ghost)
|
||||
add_fingerprint(user)
|
||||
|
||||
/obj/structure/ladder/attackby(obj/item/W, mob/user as mob, params)
|
||||
return attack_hand(user)
|
||||
/obj/structure/ladder/attack_hand(mob/user)
|
||||
use(user)
|
||||
|
||||
/obj/structure/ladder/dive_point/buoy
|
||||
/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)
|
||||
|
||||
/obj/structure/ladder/proc/show_fluff_message(going_up, mob/user)
|
||||
if(going_up)
|
||||
user.visible_message("[user] climbs up [src].","<span class='notice'>You [use_verb] up [src].</span>")
|
||||
else
|
||||
user.visible_message("[user] climbs down [src].","<span class='notice'>You [use_verb] 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(mapload)
|
||||
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/unbreakable/dive_point/buoy
|
||||
name = "diving point buoy"
|
||||
desc = "A buoy marking the location of an underwater dive area."
|
||||
icon = 'icons/misc/beach.dmi'
|
||||
icon_state = "buoy"
|
||||
id = "dive"
|
||||
height = 2
|
||||
use_verb = "dives"
|
||||
use_verb = "swim"
|
||||
layer = MOB_LAYER + 0.2 //0.1 higher than the water overlay, this also means people can "swim" behind/under it
|
||||
|
||||
/obj/structure/ladder/dive_point/anchor
|
||||
/obj/structure/ladder/unbreakable/dive_point/anchor
|
||||
name = "diving point anchor"
|
||||
desc = "An anchor tethered to the buoy at the surface, to keep the dive area marked."
|
||||
icon = 'icons/misc/beach.dmi'
|
||||
icon_state = "anchor"
|
||||
id = "dive"
|
||||
height = 1
|
||||
use_verb = "ascends"
|
||||
light_range = 5
|
||||
|
||||
/obj/structure/ladder/dive_point/New()
|
||||
..()
|
||||
/obj/structure/ladder/dive_point/Initialize(mapload)
|
||||
. = ..()
|
||||
set_light(light_range, light_power) //magical glowing anchor
|
||||
|
||||
/obj/structure/ladder/dive_point/update_icon()
|
||||
|
||||
Reference in New Issue
Block a user