Skip to content

Commit

Permalink
few more code changes, cooldown declare, punctuation, adds a few more…
Browse files Browse the repository at this point in the history
… to the Almayer
  • Loading branch information
Birdtalon committed Jan 8, 2024
1 parent d287159 commit 8894b8e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
21 changes: 11 additions & 10 deletions code/modules/paperwork/desk_bell.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/obj/item/desk_bell
name = "desk bell"
desc = "The cornerstone of any customer service job. You feel an unending urge to ring it. It looks like it can be wrenched or screwdrivered."
desc = "The cornerstone of any customer service job. You feel an unending urge to ring it."
icon = 'icons/obj/objects.dmi'
icon_state = "desk_bell"
w_class = SIZE_SMALL
Expand All @@ -12,7 +12,7 @@
/// Is this bell broken?
var/broken_ringer = FALSE
/// Holds the time that the bell can next be rang.
var/ring_cooldown = 0
COOLDOWN_DECLARE(ring_cooldown)
/// The length of the cooldown. Setting it to 0 will skip all cooldowns alltogether.
var/ring_cooldown_length = 1 SECONDS // This is here to protect against tinnitus.
/// The sound the bell makes.
Expand All @@ -23,12 +23,11 @@
return FALSE
if(!anchored)
return ..()
if(ring_cooldown > world.time)
if(!COOLDOWN_FINISHED(src, ring_cooldown))
return FALSE
if(!ring_bell(user))
to_chat(user, SPAN_NOTICE("[src] is silent. Some idiot broke it."))
return FALSE
ring_cooldown = world.time + ring_cooldown_length
return TRUE

/obj/item/desk_bell/MouseDrop(atom/over_object)
Expand All @@ -47,8 +46,8 @@
if(broken_ringer)
visible_message(SPAN_NOTICE("[user] begins repairing [src]..."), SPAN_NOTICE("You begin repairing [src]..."))
if(do_after(user, 5 SECONDS, INTERRUPT_ALL, BUSY_ICON_GENERIC))
user.visible_message(SPAN_NOTICE("[user] repairs [src]"), SPAN_NOTICE("You repair [src]."))
playsound(user, 'sound/items/Screwdriver.ogg', 50)
user.visible_message(SPAN_NOTICE("[user] repairs [src]."), SPAN_NOTICE("You repair [src]."))
playsound(src, 'sound/items/Screwdriver.ogg', 50)
broken_ringer = FALSE
times_rang = 0
return TRUE
Expand All @@ -62,25 +61,26 @@
if(HAS_TRAIT(item, TRAIT_TOOL_WRENCH))
if(user.a_intent == INTENT_HARM)
visible_message(SPAN_NOTICE("[user] begins taking apart [src]..."), SPAN_NOTICE("You begin taking apart [src]..."))
playsound(src, 'sound/items/deconstruct.ogg', 35)
if(do_after(user, 5 SECONDS, INTERRUPT_ALL, BUSY_ICON_GENERIC))
visible_message(SPAN_NOTICE("[user] takes apart [src]."), SPAN_NOTICE("You take apart [src]."))
playsound(user, 'sound/items/deconstruct.ogg', 50)
new /obj/item/stack/sheet/metal(get_turf(src))
qdel(src)
return TRUE
else
user.visible_message("[user] begins [anchored ? "un" : ""]securing [src]...", "You begin [anchored ? "un" : ""]securing [src]...")
playsound(src, 'sound/items/Ratchet.ogg', 35, vary = TRUE)
if(!do_after(user, 2 SECONDS, INTERRUPT_ALL, BUSY_ICON_GENERIC))
return FALSE
user.visible_message("[user] [anchored ? "un" : ""]secures [src].", "You [anchored ? "un" : ""]secure [src]")
user.visible_message("[user] [anchored ? "un" : ""]secures [src].", "You [anchored ? "un" : ""]secure [src].")
anchored = !anchored
return TRUE


/// Check if the clapper breaks, and if it does, break it chance to break is 1% for every 100 rings of the bell.
/obj/item/desk_bell/proc/check_clapper(mob/living/user)
if(prob(times_rang / 100))
to_chat(user, SPAN_NOTICE("You hear [src]'s clapper fall off of its hinge. Nice job, you broke it."))
to_chat(user, SPAN_NOTICE("You hear [src]'s clapper fall off of its hinge. Nice job hamfist, you broke it."))
broken_ringer = TRUE

/// Ring the bell.
Expand All @@ -89,7 +89,8 @@
return FALSE
check_clapper(user)
// The lack of varying is intentional. The only variance occurs on the strike the bell breaks.
playsound(src, ring_sound, 70, vary = broken_ringer)
COOLDOWN_START(src, ring_cooldown, ring_cooldown_length)
playsound(src, ring_sound, 80)
flick("desk_bell_activate", src)
times_rang++
return TRUE
9 changes: 8 additions & 1 deletion maps/map_files/USS_Almayer/USS_Almayer.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -77159,13 +77159,19 @@
},
/area/almayer/powered/agent)
"wph" = (
/obj/item/paper_bin/wy,
/obj/item/paper_bin/wy{
pixel_x = 5
},
/obj/structure/surface/table/woodentable/fancy,
/obj/item/tool/pen/clicky,
/obj/item/tool/pen/clicky,
/obj/structure/machinery/status_display{
pixel_x = -32
},
/obj/item/desk_bell{
pixel_x = -8;
pixel_y = 8
},
/turf/open/floor/carpet,
/area/almayer/command/corporateliaison)
"wpw" = (
Expand Down Expand Up @@ -77700,6 +77706,7 @@
dir = 1;
name = "ship-grade camera"
},
/obj/item/desk_bell,
/turf/open/floor/almayer{
dir = 6;
icon_state = "red"
Expand Down

0 comments on commit 8894b8e

Please sign in to comment.