mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 16:18:01 +01:00
refactors climbing into an element (#55978)
Co-authored-by: Fikou <piotrbryla@onet.pl> Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com> Co-authored-by: Mothblocks <35135081+Jared-Fogle@users.noreply.github.com>
This commit is contained in:
co-authored by
Fikou
Ghom
Mothblocks
parent
2ed6f84777
commit
a6a334285a
@@ -8,13 +8,7 @@
|
||||
flags_ricochet = RICOCHET_HARD
|
||||
receive_ricochet_chance_mod = 0.6
|
||||
pass_flags_self = PASSSTRUCTURE
|
||||
|
||||
var/climb_time = 20
|
||||
var/climb_stun = 20
|
||||
var/climbable = FALSE
|
||||
var/mob/living/structureclimber
|
||||
var/broken = 0 //similar to machinery's stat BROKEN
|
||||
|
||||
var/broken = FALSE
|
||||
|
||||
/obj/structure/Initialize()
|
||||
if (!armor)
|
||||
@@ -33,78 +27,10 @@
|
||||
QUEUE_SMOOTH_NEIGHBORS(src)
|
||||
return ..()
|
||||
|
||||
/obj/structure/attack_hand(mob/user)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
if(structureclimber && structureclimber != user)
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
user.do_attack_animation(src)
|
||||
structureclimber.Paralyze(40)
|
||||
structureclimber.visible_message("<span class='warning'>[structureclimber] is knocked off [src].</span>", "<span class='warning'>You're knocked off [src]!</span>", "<span class='warning'>You see [structureclimber] get knocked off [src].</span>")
|
||||
|
||||
/obj/structure/ui_act(action, params)
|
||||
add_fingerprint(usr)
|
||||
return ..()
|
||||
|
||||
/obj/structure/MouseDrop_T(atom/movable/O, mob/user)
|
||||
. = ..()
|
||||
if(!climbable)
|
||||
return
|
||||
if(user == O && isliving(O))
|
||||
var/mob/living/L = O
|
||||
if(isanimal(L))
|
||||
var/mob/living/simple_animal/A = L
|
||||
if (!A.dextrous)
|
||||
return
|
||||
if(L.mobility_flags & MOBILITY_MOVE)
|
||||
climb_structure(user)
|
||||
return
|
||||
if(!istype(O, /obj/item) || user.get_active_held_item() != O)
|
||||
return
|
||||
if(iscyborg(user))
|
||||
return
|
||||
if(!user.dropItemToGround(O))
|
||||
return
|
||||
if (O.loc != src.loc)
|
||||
step(O, get_dir(O, src))
|
||||
|
||||
/obj/structure/proc/do_climb(atom/movable/A)
|
||||
if(climbable)
|
||||
if(A.loc == src.loc)
|
||||
var/turf/where_to_climb = get_step(A,dir)
|
||||
if(!where_to_climb.is_blocked_turf())
|
||||
A.forceMove(where_to_climb)
|
||||
return TRUE
|
||||
density = FALSE
|
||||
. = step(A,get_dir(A,src.loc))
|
||||
density = TRUE
|
||||
|
||||
/obj/structure/proc/climb_structure(mob/living/user)
|
||||
src.add_fingerprint(user)
|
||||
user.visible_message("<span class='warning'>[user] starts climbing onto [src].</span>", \
|
||||
"<span class='notice'>You start climbing onto [src]...</span>")
|
||||
var/adjusted_climb_time = climb_time
|
||||
if(HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) //climbing takes twice as long without help from the hands.
|
||||
adjusted_climb_time *= 2
|
||||
if(isalien(user))
|
||||
adjusted_climb_time *= 0.25 //aliens are terrifyingly fast
|
||||
if(HAS_TRAIT(user, TRAIT_FREERUNNING)) //do you have any idea how fast I am???
|
||||
adjusted_climb_time *= 0.8
|
||||
structureclimber = user
|
||||
if(do_mob(user, user, adjusted_climb_time))
|
||||
if(src.loc) //Checking if structure has been destroyed
|
||||
if(do_climb(user))
|
||||
user.visible_message("<span class='warning'>[user] climbs onto [src].</span>", \
|
||||
"<span class='notice'>You climb onto [src].</span>")
|
||||
log_combat(user, src, "climbed onto")
|
||||
if(climb_stun)
|
||||
user.Stun(climb_stun)
|
||||
. = 1
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You fail to climb onto [src].</span>")
|
||||
structureclimber = null
|
||||
|
||||
/obj/structure/examine(mob/user)
|
||||
. = ..()
|
||||
if(!(resistance_flags & INDESTRUCTIBLE))
|
||||
|
||||
@@ -167,11 +167,15 @@
|
||||
opened = TRUE
|
||||
if(!dense_when_open)
|
||||
density = FALSE
|
||||
climb_time *= 0.5 //it's faster to climb onto an open thing
|
||||
dump_contents()
|
||||
update_icon()
|
||||
after_open(user, force)
|
||||
return TRUE
|
||||
|
||||
///Proc to override for effects after opening a door
|
||||
/obj/structure/closet/proc/after_open(mob/living/user, force = FALSE)
|
||||
return
|
||||
|
||||
/obj/structure/closet/proc/insert(atom/movable/AM)
|
||||
if(contents.len >= storage_capacity)
|
||||
return -1
|
||||
@@ -218,12 +222,17 @@
|
||||
return FALSE
|
||||
take_contents()
|
||||
playsound(loc, close_sound, close_sound_volume, TRUE, -3)
|
||||
climb_time = initial(climb_time)
|
||||
opened = FALSE
|
||||
density = TRUE
|
||||
update_icon()
|
||||
after_close(user)
|
||||
return TRUE
|
||||
|
||||
///Proc to override for effects after closing a door
|
||||
/obj/structure/closet/proc/after_close(mob/living/user)
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/closet/proc/toggle(mob/living/user)
|
||||
if(opened)
|
||||
return close(user)
|
||||
|
||||
@@ -9,15 +9,13 @@
|
||||
allow_objects = TRUE
|
||||
allow_dense = TRUE
|
||||
dense_when_open = TRUE
|
||||
climbable = TRUE
|
||||
climb_time = 10 //real fast, because let's be honest stepping into or onto a crate is easy
|
||||
climb_stun = 0 //climbing onto crates isn't hard, guys
|
||||
delivery_icon = "deliverycrate"
|
||||
open_sound = 'sound/machines/crate_open.ogg'
|
||||
close_sound = 'sound/machines/crate_close.ogg'
|
||||
open_sound_volume = 35
|
||||
close_sound_volume = 50
|
||||
drag_slowdown = 0
|
||||
var/climb_time = 20
|
||||
var/obj/item/paper/fluff/jobs/cargo/manifest/manifest
|
||||
|
||||
/obj/structure/closet/crate/Initialize()
|
||||
@@ -25,6 +23,7 @@
|
||||
if(icon_state == "[initial(icon_state)]open")
|
||||
opened = TRUE
|
||||
update_icon()
|
||||
AddElement(/datum/element/climbable, climb_time = opened ? climb_time : climb_time * 0.5, climb_stun = 0)
|
||||
|
||||
/obj/structure/closet/crate/CanAllowThrough(atom/movable/mover, turf/target)
|
||||
. = ..()
|
||||
@@ -51,6 +50,17 @@
|
||||
if(manifest)
|
||||
tear_manifest(user)
|
||||
|
||||
/obj/structure/closet/crate/after_open(mob/living/user, force)
|
||||
. = ..()
|
||||
RemoveElement(/datum/element/climbable)
|
||||
AddElement(/datum/element/climbable, climb_time = climb_time * 0.5, climb_stun = 0)
|
||||
|
||||
/obj/structure/closet/crate/after_close(mob/living/user)
|
||||
. = ..()
|
||||
RemoveElement(/datum/element/climbable)
|
||||
AddElement(/datum/element/climbable, climb_time = climb_time, climb_stun = 0)
|
||||
|
||||
|
||||
/obj/structure/closet/crate/open(mob/living/user, force = FALSE)
|
||||
. = ..()
|
||||
if(. && manifest)
|
||||
|
||||
@@ -79,11 +79,11 @@
|
||||
if(MEDIUM_HOLE)
|
||||
visible_message("<span class='notice'>\The [user] cuts into \the [src] some more.</span>")
|
||||
to_chat(user, "<span class='info'>You could probably fit yourself through that hole now. Although climbing through would be much faster if you made it even bigger.</span>")
|
||||
climbable = TRUE
|
||||
AddElement(/datum/element/climbable)
|
||||
if(LARGE_HOLE)
|
||||
visible_message("<span class='notice'>\The [user] completely cuts through \the [src].</span>")
|
||||
to_chat(user, "<span class='info'>The hole in \the [src] is now big enough to walk through.</span>")
|
||||
climbable = FALSE
|
||||
RemoveElement(/datum/element/climbable)
|
||||
|
||||
update_cut_status()
|
||||
|
||||
|
||||
@@ -5,7 +5,10 @@
|
||||
icon_state = "railing"
|
||||
density = TRUE
|
||||
anchored = TRUE
|
||||
climbable = TRUE
|
||||
|
||||
var/climbable = TRUE
|
||||
///Initial direction of the railing.
|
||||
var/ini_dir
|
||||
|
||||
/obj/structure/railing/corner //aesthetic corner sharp edges hurt oof ouch
|
||||
icon_state = "railing_corner"
|
||||
@@ -16,6 +19,13 @@
|
||||
. = ..()
|
||||
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS ,null,CALLBACK(src, .proc/can_be_rotated),CALLBACK(src,.proc/after_rotation))
|
||||
|
||||
|
||||
/obj/structure/railing/Initialize()
|
||||
. = ..()
|
||||
ini_dir = dir
|
||||
if(climbable)
|
||||
AddElement(/datum/element/climbable)
|
||||
|
||||
/obj/structure/railing/attackby(obj/item/I, mob/living/user, params)
|
||||
..()
|
||||
add_fingerprint(user)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
anchored = TRUE
|
||||
pass_flags_self = PASSTABLE | LETPASSTHROW
|
||||
layer = TABLE_LAYER
|
||||
climbable = TRUE
|
||||
var/frame = /obj/structure/table_frame
|
||||
var/framestack = /obj/item/stack/rods
|
||||
var/buildstack = /obj/item/stack/sheet/metal
|
||||
@@ -37,6 +36,12 @@
|
||||
smoothing_groups = list(SMOOTH_GROUP_TABLES)
|
||||
canSmoothWith = list(SMOOTH_GROUP_TABLES)
|
||||
|
||||
/obj/structure/table/Initialize(mapload, _buildstack)
|
||||
. = ..()
|
||||
if(_buildstack)
|
||||
buildstack = _buildstack
|
||||
AddElement(/datum/element/climbable)
|
||||
|
||||
/obj/structure/table/examine(mob/user)
|
||||
. = ..()
|
||||
. += deconstruction_hints(user)
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
density = TRUE
|
||||
layer = LOW_ITEM_LAYER
|
||||
anchored = TRUE
|
||||
climbable = TRUE
|
||||
pass_flags_self = PASSGLASS
|
||||
var/tube_construction = /obj/structure/c_transit_tube
|
||||
var/list/tube_dirs //list of directions this tube section can connect to.
|
||||
@@ -20,6 +19,7 @@
|
||||
setDir(newdirection)
|
||||
init_tube_dirs()
|
||||
generate_tube_overlays()
|
||||
AddElement(/datum/element/climbable)
|
||||
|
||||
/obj/structure/transit_tube/Destroy()
|
||||
for(var/obj/structure/transit_tube_pod/P in loc)
|
||||
|
||||
Reference in New Issue
Block a user