Files
Bubberstation/code/game/objects/items/devices/table_clock.dm
T
MrMelbert bc2215667f Re-refactors batons / Refactors attack chain force modifiers (#90809)
Melee attack chain now has a list passed along with it,
`attack_modifiers`, which you can stick force modifiers to change the
resulting attack

This is basically a soft implementation of damage packets until a more
definitive pr, but one that only applies to item attack chain, and not
unarmed attacks.

This change was done to facilitate a baton refactor - batons no longer
hack together their own attack chain, and are now integrated straight
into the real attack chain. This refactor itself was done because batons
don't send any attack signals, which has been annoying in the past (for
swing combat).

🆑 Melbert
refactor: Batons have been refactored again. Baton stuns now properly
count as an attack, when before it was a nothing. Report any oddities,
particularly in regards to harmbatonning vs normal batonning.
refactor: The method of adjusting item damage mid-attack has been
refactored - some affected items include the Nullblade and knives.
Report any strange happenings with damage numbers.
refactor: A few objects have been moved to the new interaction chain -
records consoles, mawed crucible, alien weeds and space vines, hedges,
restaurant portals, and some mobs - to name a few.
fix: Spears only deal bonus damage against secure lockers, not all
closet types (including crates)
/🆑
2025-05-22 21:30:07 -04:00

89 lines
2.8 KiB
Plaintext

///Maximum amount of times a clock can be repaired until it's destroyed beyond repair.
#define MAX_CLOCK_REPAIRS 2
/obj/item/table_clock
name = "table clock"
desc = "An annoying clock that keeps you sane through tireless nights."
icon = 'icons/obj/fluff/general.dmi'
icon_state = "table_clock"
inhand_icon_state = "table_clock"
base_icon_state = "table_clock"
w_class = WEIGHT_CLASS_TINY
///Soundloop we use of a clock ticking.
var/datum/looping_sound/clock/soundloop
///Boolean on whether the clock has been destroyed.
var/broken = FALSE
///Amount of times the clock has been destroyed. It becomes unrepairable the third time.
var/times_broken
/obj/item/table_clock/Initialize(mapload)
. = ..()
soundloop = new(src, TRUE)
/obj/item/table_clock/Destroy(force)
soundloop.stop()
return ..()
/obj/item/table_clock/examine(mob/user)
. = ..()
if(broken)
. += span_info("It appears to be currently broken. You can use it in-hand to repair it.")
else
. += span_info("The current CST (local) time is: [station_time_timestamp()].")
. += span_info("The current TCT (galactic) time is: [time2text(world.realtime, "hh:mm:ss", NO_TIMEZONE)].")
/obj/item/table_clock/attackby(obj/item/attacking_item, mob/user, list/modifiers, list/attack_modifiers)
. = ..()
if(attacking_item.force < 5 || broken)
return
if(break_clock(break_sound = 'sound/effects/magic/clockwork/ark_activation.ogg'))
user.visible_message(
span_warning("[user] smashes \the [src] so hard it stops breaking!"),
span_bolddanger("I can't stand this stupid machine anymore! Shut up already!"),
span_notice("You hear repeated smashing!"),
)
/obj/item/table_clock/throw_at(atom/target, range, speed, mob/thrower, spin, diagonals_first, datum/callback/callback, force, gentle, quickstart, throw_type_path = /datum/thrownthing)
. = ..()
if(!.)
return
break_clock(break_sound = 'sound/effects/footstep/glass_step.ogg')
/obj/item/table_clock/interact(mob/user)
. = ..()
if(!broken)
to_chat(user, span_warning("Touch the clock? And risk breaking it? Are you crazy??"))
return
if(times_broken > MAX_CLOCK_REPAIRS)
user.balloon_alert(user, "clock unrepairable!")
return
user.balloon_alert(user, "fixing clock...")
if(!do_after(user, 10 SECONDS, src))
return
user.balloon_alert(user, "clock repaired!")
broken = FALSE
soundloop.start()
update_appearance(UPDATE_ICON)
/obj/item/table_clock/update_icon_state()
icon_state = "[base_icon_state][broken ? "_broken" : null]"
return ..()
/**
* Breaks the clock, turning off the soundloop.
* Returns TRUE if it successfully breaks, FALSE otherwise.
*/
/obj/item/table_clock/proc/break_clock(break_sound)
if(broken)
return FALSE
broken = TRUE
soundloop.stop()
playsound(src, break_sound, 40, FALSE)
times_broken++
update_appearance(UPDATE_ICON)
return TRUE
#undef MAX_CLOCK_REPAIRS