Skip to content

Commit

Permalink
Revives cmss13-devs#5330: Desk Bells (cmss13-devs#5973)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->

Revives cmss13-devs#5330.
Cooldown adjusted because I know how much of a headache a 1 second
cooldown would give.
Credit:
Modified code and desk_bell.ogg from [Paradise
SS13](https://github.com/ParadiseSS13/Paradise)
Sprite from Kat 'APC' Smith - darklordcabbage on discord. I just
modified it a bit according to nauticall's review on the past PR.
Animated sprite from Thwomp. Also modified.
Birdtalon for the code.

<!-- Remove this text and explain what the purpose of your PR is.

Mention if you have tested your changes. If you changed a map, make sure
you used the mapmerge tool.
If this is an Issue Correction, you can type "Fixes Issue #169420" to
link the PR to the corresponding Issue number #169420.

Remember: something that is self-evident to you might not be to others.
Explain your rationale fully, even if you feel it goes without saying.
-->

# Explain why it's good for the game

Grab req's attention without having to point at their floor.
Grab the offscreen WJ's attention.
Immersion?


# Testing Photographs and Procedure
<!-- Include any screenshots/videos/debugging steps of the modified code
functioning successfully, ideally including edge cases. -->

<!-- !! If you are modifying sprites, you **must** include one or more
in-game screenshots or videos of the new sprites. !! -->

<details>
<summary>Screenshots & Videos</summary>


![image](https://github.com/cmss13-devs/cmss13/assets/42235601/7e6bbacd-7144-4a4a-bf8c-9ef25bba6135)

![image](https://github.com/cmss13-devs/cmss13/assets/42235601/02aeca97-3d9d-4af5-b905-5efc355b57df)


</details>


# Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
label your changes in the changelog. Please note that maintainers freely
reserve the right to remove and add tags should they deem it
appropriate. You can attempt to finagle the system all you want, but
it's best to shoot for clear communication right off the bat. -->
<!-- If you add a name after the ':cl', that name will be used in the
changelog. You must add your CKEY after the CL if your GitHub name
doesn't match. Maintainers freely reserve the right to remove and add
tags should they deem it appropriate. -->

:cl: Birdtalon, Kat 'APC' Smith, Thwomp, Waseemq1235
add: Desk bell for cargo, medbay, brig, and AI reception.
soundadd: Desk bell sound effect.
/:cl:

<!-- Both :cl:'s are required for the changelog to work! -->

---------

Co-authored-by: SabreML <[email protected]>
  • Loading branch information
Waseemq1235 and SabreML authored Mar 24, 2024
1 parent 806863a commit b5a595c
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 2 deletions.
95 changes: 95 additions & 0 deletions code/modules/paperwork/desk_bell.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// A receptionist's bell

/obj/item/desk_bell
name = "desk bell"
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
embeddable = FALSE
/// The amount of times this bell has been rang, used to check the chance it breaks.
var/times_rang = 0
/// Is this bell broken?
var/broken_ringer = FALSE
/// Holds the time that the bell can next be rang.
COOLDOWN_DECLARE(ring_cooldown)
/// The length of the cooldown. Setting it to 0 will skip all cooldowns alltogether.
var/ring_cooldown_length = 5 SECONDS // This is here to protect against tinnitus.
/// The sound the bell makes.
var/ring_sound = 'sound/misc/desk_bell.ogg'

/obj/item/desk_bell/attack_hand(mob/living/user)
if(!ishuman(user))
return FALSE
if(!anchored)
return ..()
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
return TRUE

/obj/item/desk_bell/MouseDrop(atom/over_object)
var/mob/mob = usr
if(!Adjacent(mob) || anchored)
return
if(!ishuman(mob))
return

if(over_object == mob)
mob.put_in_hands(src)

/obj/item/desk_bell/attackby(obj/item/item, mob/user)
//Repair the desk bell if its broken and we're using a screwdriver.
if(HAS_TRAIT(item, TRAIT_TOOL_SCREWDRIVER))
if(broken_ringer)
user.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(src, 'sound/items/Screwdriver.ogg', 50)
broken_ringer = FALSE
times_rang = 0
return TRUE
return FALSE

//Return at this point if we're not on a turf so we don't anchor or unanchor inside our bag/hands or inventory.
if(!isturf(loc))
return

//Wrenching down and unwrenching.
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]."))
new /obj/item/stack/sheet/metal(get_turf(src))
qdel(src)
return TRUE
else
user.visible_message(SPAN_NOTICE("[user] begins [anchored ? "un" : ""]securing [src]..."), SPAN_NOTICE("You begin [anchored ? "un" : ""]securing [src]..."))
playsound(src, 'sound/items/Ratchet.ogg', 35, TRUE)
if(!do_after(user, 2 SECONDS, INTERRUPT_ALL, BUSY_ICON_GENERIC))
return FALSE
user.visible_message(SPAN_NOTICE("[user] [anchored ? "un" : ""]secures [src]."), SPAN_NOTICE("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 hamfist, you broke it."))
broken_ringer = TRUE

/// Ring the bell.
/obj/item/desk_bell/proc/ring_bell(mob/living/user)
if(broken_ringer)
return FALSE
check_clapper(user)
COOLDOWN_START(src, ring_cooldown, ring_cooldown_length)
playsound(src, ring_sound, 80)
flick("desk_bell_activate", src)
times_rang++
return TRUE
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2165,6 +2165,7 @@
#include "code\modules\organs\wound.dm"
#include "code\modules\paperwork\carbonpaper.dm"
#include "code\modules\paperwork\clipboard.dm"
#include "code\modules\paperwork\desk_bell.dm"
#include "code\modules\paperwork\filingcabinet.dm"
#include "code\modules\paperwork\folders.dm"
#include "code\modules\paperwork\notepad.dm"
Expand Down
Binary file modified icons/obj/objects.dmi
Binary file not shown.
32 changes: 30 additions & 2 deletions maps/map_files/USS_Almayer/USS_Almayer.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -3287,6 +3287,11 @@
unacidable = 1;
unslashable = 1
},
/obj/item/desk_bell{
pixel_x = -6;
pixel_y = 10;
anchored = 1
},
/turf/open/floor/almayer/aicore/no_build,
/area/almayer/command/airoom)
"asH" = (
Expand Down Expand Up @@ -16102,6 +16107,11 @@
},
/obj/structure/machinery/door/firedoor/border_only/almayer,
/obj/structure/surface/table/reinforced/almayer_blend/north,
/obj/item/desk_bell{
pixel_x = -6;
pixel_y = -8;
anchored = 1
},
/turf/open/floor/almayer{
icon_state = "test_floor4"
},
Expand Down Expand Up @@ -16392,6 +16402,11 @@
},
/obj/structure/machinery/door/firedoor/border_only/almayer,
/obj/structure/surface/table/reinforced/almayer_blend,
/obj/item/desk_bell{
pixel_x = -6;
pixel_y = 10;
anchored = 1
},
/turf/open/floor/almayer{
icon_state = "test_floor4"
},
Expand Down Expand Up @@ -38970,8 +38985,11 @@
/obj/structure/machinery/door/window/eastleft{
req_access_txt = "8"
},
/obj/item/book/manual/medical_diagnostics_manual,
/obj/item/device/megaphone,
/obj/item/desk_bell{
pixel_x = -6;
pixel_y = 10;
anchored = 1
},
/turf/open/floor/almayer{
icon_state = "sterile_green"
},
Expand Down Expand Up @@ -68610,6 +68628,8 @@
dir = 8;
pixel_x = 17
},
/obj/item/device/megaphone,
/obj/item/book/manual/medical_diagnostics_manual,
/turf/open/floor/almayer{
icon_state = "sterile_green_side"
},
Expand Down Expand Up @@ -77188,6 +77208,11 @@
/obj/structure/machinery/status_display{
pixel_x = -32
},
/obj/item/desk_bell{
anchored = 1;
pixel_x = -8;
pixel_y = 8
},
/turf/open/floor/carpet,
/area/almayer/command/corporateliaison)
"wpu" = (
Expand Down Expand Up @@ -77866,6 +77891,9 @@
dir = 1;
name = "ship-grade camera"
},
/obj/item/desk_bell{
anchored = 1
},
/turf/open/floor/almayer{
dir = 6;
icon_state = "red"
Expand Down
Binary file added sound/misc/desk_bell.ogg
Binary file not shown.

0 comments on commit b5a595c

Please sign in to comment.