Files
Will 5d31f14e94 Climbable Element (#17764)
* Initial work

* small fix

* another fix

* this better?

* proper type

* condensing this a bit

* functioning

* death reporting subsystemed

* fixed

* cleanup

* use proper sql sending

* listvar

* add more climbable things

* moving things while climbing them is considered shaking

* tabbing fix

* knockdown should stop climbing

* no need to bother

* spaces

* more climbable objects

* fix

* small fixes

* office climbables

* yet more stuff

* engineering things

* a few more

* it's funny

* fixes

* additional

* Moved to element

* some more stragglers

* unneeded

* more graceful

* cliffs require special handling

* don't do dumb init things

* unneeded sanitization, mass insert sanitizes

* some small condition fixes

* return if climbable

* incorporeal check

* stop using numbers directly

* .

---------

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
2025-06-20 09:56:56 +02:00

148 lines
4.3 KiB
Plaintext

/obj/structure/gravemarker
name = "grave marker"
desc = "An object used in marking graves."
icon_state = "gravemarker"
density = TRUE
anchored = TRUE
throwpass = 1
layer = ABOVE_JUNK_LAYER
//Maybe make these calculate based on material?
var/health = 100
var/grave_name = "" //Name of the intended occupant
var/epitaph = "" //A quick little blurb
// var/dir_locked = 0 //Can it be spun? Not currently implemented
var/datum/material/material
/obj/structure/gravemarker/Initialize(mapload, var/material_name)
. = ..()
if(!material_name)
material_name = MAT_WOOD
material = get_material_by_name("[material_name]")
if(!material)
return INITIALIZE_HINT_QDEL
color = material.icon_colour
AddElement(/datum/element/climbable)
/obj/structure/gravemarker/examine(mob/user)
. = ..()
if(grave_name && get_dist(src, user) < 4)
. += "Here Lies [grave_name]"
if(epitaph && get_dist(src, user) < 2)
. += epitaph
/obj/structure/gravemarker/CanPass(atom/movable/mover, turf/target)
if(istype(mover) && mover.checkpass(PASSTABLE))
return TRUE
if(get_dir(mover, target) == GLOB.reverse_dir[dir]) // From elsewhere to here, can't move against our dir
return !density
return TRUE
/obj/structure/gravemarker/Uncross(atom/movable/mover, turf/target)
if(istype(mover) && mover.checkpass(PASSTABLE))
return TRUE
if(get_dir(mover, target) == dir) // From here to elsewhere, can't move in our dir
return !density
return TRUE
/obj/structure/gravemarker/attackby(obj/item/W, mob/user as mob)
if(W.has_tool_quality(TOOL_SCREWDRIVER))
var/carving_1 = sanitizeSafe(tgui_input_text(user, "Who is \the [src.name] for?", "Gravestone Naming", null, MAX_NAME_LEN), MAX_NAME_LEN)
if(carving_1)
user.visible_message("[user] starts carving \the [src.name].", "You start carving \the [src.name].")
if(do_after(user, material.hardness * W.toolspeed))
user.visible_message("[user] carves something into \the [src.name].", "You carve your message into \the [src.name].")
grave_name += carving_1
update_icon()
var/carving_2 = sanitizeSafe(tgui_input_text(user, "What message should \the [src.name] have?", "Epitaph Carving", null, MAX_NAME_LEN), MAX_NAME_LEN)
if(carving_2)
user.visible_message("[user] starts carving \the [src.name].", "You start carving \the [src.name].")
if(do_after(user, material.hardness * W.toolspeed))
user.visible_message("[user] carves something into \the [src.name].", "You carve your message into \the [src.name].")
epitaph += carving_2
update_icon()
return
if(W.has_tool_quality(TOOL_WRENCH))
user.visible_message("[user] starts taking down \the [src.name].", "You start taking down \the [src.name].")
if(do_after(user, material.hardness * W.toolspeed))
user.visible_message("[user] takes down \the [src.name].", "You take down \the [src.name].")
dismantle()
..()
/obj/structure/gravemarker/bullet_act(var/obj/item/projectile/Proj)
var/proj_damage = Proj.get_structure_damage()
if(!proj_damage)
return
..()
damage(proj_damage)
return
/obj/structure/gravemarker/ex_act(severity)
switch(severity)
if(1.0)
visible_message(span_danger("\The [src] is blown apart!"))
qdel(src)
return
if(2.0)
visible_message(span_danger("\The [src] is blown apart!"))
if(prob(50))
dismantle()
else
qdel(src)
return
/obj/structure/gravemarker/proc/damage(var/damage)
health -= damage
if(health <= 0)
visible_message(span_danger("\The [src] falls apart!"))
dismantle()
/obj/structure/gravemarker/proc/dismantle()
material.place_dismantled_product(get_turf(src))
qdel(src)
return
/obj/structure/gravemarker/verb/rotate_clockwise()
set name = "Rotate Grave Marker Clockwise"
set category = "Object"
set src in oview(1)
if(anchored)
return
if(!usr || !isturf(usr.loc))
return
if(usr.stat || usr.restrained())
return
if(ismouse(usr) || (isobserver(usr) && !CONFIG_GET(flag/ghost_interaction)))
return
src.set_dir(turn(src.dir, 270))
return
//VOREstation edit: counter-clockwise rotation
/obj/structure/gravemarker/verb/rotate_counterclockwise()
set name = "Rotate Grave Marker Counter-Clockwise"
set category = "Object"
set src in oview(1)
if(anchored)
return
if(!usr || !isturf(usr.loc))
return
if(usr.stat || usr.restrained())
return
if(ismouse(usr) || (isobserver(usr) && !CONFIG_GET(flag/ghost_interaction)))
return
src.set_dir(turn(src.dir, 90))
return