mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-18 21:15:21 +00:00
## About The Pull Request  This Pull request updates the sprites used by railings, including both directional, corner, outer corner, and rail ending sprites. Additionally, I've placed railings on the GAME_PLANE_UPPER plane, so that visually it looks like railings in front of a player can physically stand in front of the player. ## Why It's Good For The Game This ports the railing sprites I did for The Wallening (tm) onto live, providing a 3/4ths perspective sprite, in addition to the fact that it'll help sell the height of objects by layering in a more satisfying way. Not to mention, I just think they're way better than current railings, where are both ancient and super flat sprites. ## Changelog 🆑 image: Railings have had a visual update. /🆑
152 lines
4.4 KiB
Plaintext
152 lines
4.4 KiB
Plaintext
/obj/structure/railing
|
|
name = "railing"
|
|
desc = "Basic railing meant to protect idiots like you from falling."
|
|
icon = 'icons/obj/railings.dmi'
|
|
icon_state = "railing"
|
|
flags_1 = ON_BORDER_1
|
|
obj_flags = CAN_BE_HIT | BLOCKS_CONSTRUCTION_DIR
|
|
density = TRUE
|
|
anchored = TRUE
|
|
pass_flags_self = LETPASSTHROW|PASSSTRUCTURE
|
|
layer = ABOVE_MOB_LAYER
|
|
plane = GAME_PLANE_UPPER
|
|
/// armor is a little bit less than a grille. max_integrity about half that of a grille.
|
|
armor_type = /datum/armor/structure_railing
|
|
max_integrity = 25
|
|
|
|
var/climbable = TRUE
|
|
///Initial direction of the railing.
|
|
var/ini_dir
|
|
|
|
/datum/armor/structure_railing
|
|
melee = 35
|
|
bullet = 50
|
|
laser = 50
|
|
energy = 100
|
|
bomb = 10
|
|
|
|
/obj/structure/railing/corner //aesthetic corner sharp edges hurt oof ouch
|
|
icon_state = "railing_corner"
|
|
density = FALSE
|
|
climbable = FALSE
|
|
|
|
/obj/structure/railing/corner/end //end of a segment of railing without making a loop
|
|
icon_state = "railing_end"
|
|
|
|
/obj/structure/railing/corner/end/flip //same as above but flipped around
|
|
icon_state = "railing_end_flip"
|
|
|
|
/obj/structure/railing/Initialize(mapload)
|
|
. = ..()
|
|
ini_dir = dir
|
|
if(climbable)
|
|
AddElement(/datum/element/climbable)
|
|
|
|
if(density && flags_1 & ON_BORDER_1) // blocks normal movement from and to the direction it's facing.
|
|
var/static/list/loc_connections = list(
|
|
COMSIG_ATOM_EXIT = PROC_REF(on_exit),
|
|
)
|
|
AddElement(/datum/element/connect_loc, loc_connections)
|
|
|
|
var/static/list/tool_behaviors = list(
|
|
TOOL_WELDER = list(
|
|
SCREENTIP_CONTEXT_LMB = "Repair",
|
|
),
|
|
TOOL_WRENCH = list(
|
|
SCREENTIP_CONTEXT_LMB = "Anchor/Unanchor",
|
|
),
|
|
TOOL_WIRECUTTER = list(
|
|
SCREENTIP_CONTEXT_LMB = "Deconstruct",
|
|
),
|
|
)
|
|
AddElement(/datum/element/contextual_screentip_tools, tool_behaviors)
|
|
|
|
AddComponent(/datum/component/simple_rotation, ROTATION_NEEDS_ROOM)
|
|
|
|
/obj/structure/railing/attackby(obj/item/I, mob/living/user, params)
|
|
..()
|
|
add_fingerprint(user)
|
|
|
|
if(I.tool_behaviour == TOOL_WELDER && !user.combat_mode)
|
|
if(atom_integrity < max_integrity)
|
|
if(!I.tool_start_check(user, amount=1))
|
|
return
|
|
|
|
to_chat(user, span_notice("You begin repairing [src]..."))
|
|
if(I.use_tool(src, user, 40, volume=50))
|
|
atom_integrity = max_integrity
|
|
to_chat(user, span_notice("You repair [src]."))
|
|
else
|
|
to_chat(user, span_warning("[src] is already in good condition!"))
|
|
return
|
|
|
|
/obj/structure/railing/AltClick(mob/user)
|
|
return ..() // This hotkey is BLACKLISTED since it's used by /datum/component/simple_rotation
|
|
|
|
/obj/structure/railing/wirecutter_act(mob/living/user, obj/item/I)
|
|
. = ..()
|
|
to_chat(user, span_warning("You cut apart the railing."))
|
|
I.play_tool_sound(src, 100)
|
|
deconstruct()
|
|
return TRUE
|
|
|
|
/obj/structure/railing/deconstruct(disassembled)
|
|
if(!(flags_1 & NODECONSTRUCT_1))
|
|
if (istype(src,/obj/structure/railing/corner)) // Corner railings only cost 1 rod
|
|
var/obj/item/stack/rods/rod = new /obj/item/stack/rods(drop_location(), 1)
|
|
transfer_fingerprints_to(rod)
|
|
else
|
|
var/obj/item/stack/rods/rod = new /obj/item/stack/rods(drop_location(), 2)
|
|
transfer_fingerprints_to(rod)
|
|
return ..()
|
|
|
|
///Implements behaviour that makes it possible to unanchor the railing.
|
|
/obj/structure/railing/wrench_act(mob/living/user, obj/item/I)
|
|
. = ..()
|
|
if(flags_1&NODECONSTRUCT_1)
|
|
return
|
|
to_chat(user, span_notice("You begin to [anchored ? "unfasten the railing from":"fasten the railing to"] the floor..."))
|
|
if(I.use_tool(src, user, volume = 75, extra_checks = CALLBACK(src, PROC_REF(check_anchored), anchored)))
|
|
set_anchored(!anchored)
|
|
to_chat(user, span_notice("You [anchored ? "fasten the railing to":"unfasten the railing from"] the floor."))
|
|
return TRUE
|
|
|
|
/obj/structure/railing/CanPass(atom/movable/mover, border_dir)
|
|
. = ..()
|
|
if(border_dir & dir)
|
|
return . || mover.throwing || mover.movement_type & (FLYING | FLOATING)
|
|
return TRUE
|
|
|
|
/obj/structure/railing/CanAStarPass(obj/item/card/id/ID, to_dir, atom/movable/caller, no_id = FALSE)
|
|
if(!(to_dir & dir))
|
|
return TRUE
|
|
return ..()
|
|
|
|
/obj/structure/railing/proc/on_exit(datum/source, atom/movable/leaving, direction)
|
|
SIGNAL_HANDLER
|
|
|
|
if(leaving == src)
|
|
return // Let's not block ourselves.
|
|
|
|
if(!(direction & dir))
|
|
return
|
|
|
|
if (!density)
|
|
return
|
|
|
|
if (leaving.throwing)
|
|
return
|
|
|
|
if (leaving.movement_type & (PHASING | FLYING | FLOATING))
|
|
return
|
|
|
|
if (leaving.move_force >= MOVE_FORCE_EXTREMELY_STRONG)
|
|
return
|
|
|
|
leaving.Bump(src)
|
|
return COMPONENT_ATOM_BLOCK_EXIT
|
|
|
|
/obj/structure/railing/proc/check_anchored(checked_anchored)
|
|
if(anchored == checked_anchored)
|
|
return TRUE
|