Skip to content

Commit

Permalink
Makes dartboards functional (#4677)
Browse files Browse the repository at this point in the history
# About the pull request

adds basic functionality to dartboards and makes them craftable with
cardboard.
fixes a bug where some signs lose their icon when deconstructed.

# Explain why it's good for the game
the dartboard's been sitting there, looking pretty and doing nothing
else for a good while. more intractability with props is always fun to
see.
# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>


https://github.com/cmss13-devs/cmss13/assets/17518895/4496198d-5a7d-4511-a5bf-894c4df98588

</details>


# Changelog
:cl:
add: Dartboards are now functional and can be crafted with cardboard.
fix: Fixed an issue with some deconstructed signs losing their icon.
/:cl:

---------

Co-authored-by: harryob <[email protected]>
  • Loading branch information
VileBeggar and harryob committed Oct 19, 2023
1 parent afe9ecf commit d23a254
Show file tree
Hide file tree
Showing 4 changed files with 1,352 additions and 1,233 deletions.
1 change: 1 addition & 0 deletions code/game/objects/items/stacks/sheets/sheet_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ var/global/list/datum/stack_recipe/cardboard_recipes = list ( \
new/datum/stack_recipe("cardborg suit", /obj/item/clothing/suit/cardborg, 3), \
new/datum/stack_recipe("cardborg helmet", /obj/item/clothing/head/cardborg), \
new/datum/stack_recipe("pizza box", /obj/item/pizzabox), \
new/datum/stack_recipe("dartboard", /obj/item/dartboard), \
null, \
new/datum/stack_recipe_list("folders",list( \
new/datum/stack_recipe("blue folder", /obj/item/folder/blue), \
Expand Down
123 changes: 123 additions & 0 deletions code/game/objects/structures/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,126 @@

/obj/structure/computer3frame/laptop
name = "laptop frame"

// Dartboard
#define DOUBLE_BAND 2
#define TRIPLE_BAND 3

/obj/structure/dartboard
name = "dartboard"
desc = "A dartboard, loosely secured."
icon = 'icons/obj/structures/props/props.dmi'
icon_state = "dart_board"
density = TRUE
unslashable = TRUE

/obj/structure/dartboard/get_examine_text()
. = ..()
if(length(contents))
var/is_are = "is"
if(length(contents) != 1)
is_are = "are"

. += SPAN_NOTICE("There [is_are] [length(contents)] item\s embedded into [src].")

/obj/structure/dartboard/initialize_pass_flags(datum/pass_flags_container/pass_flags)
..()
if(pass_flags)
pass_flags.flags_can_pass_all = PASS_MOB_IS

/obj/structure/dartboard/get_projectile_hit_boolean(obj/projectile/projectile)
. = ..()
visible_message(SPAN_DANGER("[projectile] hits [src], collapsing it!"))
collapse()

/obj/structure/dartboard/proc/flush_contents()
for(var/atom/movable/embedded_items as anything in contents)
embedded_items.forceMove(loc)

/obj/structure/dartboard/proc/collapse()
playsound(src, 'sound/effects/thud1.ogg', 50)
new /obj/item/dartboard/(loc)
qdel(src)

/obj/structure/dartboard/attack_hand(mob/user)
if(length(contents))
user.visible_message(SPAN_NOTICE("[user] starts recovering items from [src]..."), SPAN_NOTICE("You start recovering items from [src]..."))
if(do_after(user, 1 SECONDS, INTERRUPT_ALL, BUSY_ICON_FRIENDLY, user, INTERRUPT_MOVED, BUSY_ICON_GENERIC))
flush_contents()
else
to_chat(user, SPAN_WARNING("[src] has nothing embedded!"))

/obj/structure/dartboard/Destroy()
flush_contents()
. = ..()

/obj/structure/dartboard/hitby(obj/item/thrown_item)
if(thrown_item.sharp != IS_SHARP_ITEM_ACCURATE && !istype(thrown_item, /obj/item/weapon/dart))
visible_message(SPAN_DANGER("[thrown_item] hits [src], collapsing it!"))
collapse()
return

contents += thrown_item
playsound(src, 'sound/weapons/tablehit1.ogg', 50)
var/score = rand(1,21)
if(score == 21)
visible_message(SPAN_DANGER("[thrown_item] embeds into [src], striking the bullseye! 50 points."))
return

var/band = "single"
var/band_number = rand(1,3)
score *= band_number
switch(band_number)
if(DOUBLE_BAND)
band = "double"
if(TRIPLE_BAND)
band = "triple"
visible_message(SPAN_DANGER("[thrown_item] embeds into [src], striking [band] for [score] point\s."))

/obj/structure/dartboard/attackby(obj/item/item, mob/user)
user.visible_message(SPAN_DANGER("[user] hits [src] with [item], collapsing it!"), SPAN_DANGER("You collapse [src] with [item]!"))
collapse()

/obj/structure/dartboard/MouseDrop(over_object, src_location, over_location)
. = ..()
if(over_object != usr || !Adjacent(usr))
return

if(!ishuman(usr))
return

visible_message(SPAN_NOTICE("[usr] unsecures [src]."))
var/obj/item/dartboard/unsecured_board = new(loc)
usr.put_in_hands(unsecured_board)
qdel(src)

/obj/item/dartboard
name = "dartboard"
desc = "A dartboard for darts."
icon = 'icons/obj/structures/props/props.dmi'
icon_state = "dart_board"

/obj/item/dartboard/attack_self(mob/user)
. = ..()

var/turf_ahead = get_step(user, user.dir)
if(!istype(turf_ahead, /turf/closed))
to_chat(user, SPAN_WARNING("[src] needs a wall to be secured to!"))
return

var/obj/structure/dartboard/secured_board = new(user.loc)
switch(user.dir)
if(NORTH)
secured_board.pixel_y = 32
if(EAST)
secured_board.pixel_x = 32
if(SOUTH)
secured_board.pixel_y = -32
if(WEST)
secured_board.pixel_x = -32

to_chat(user, SPAN_NOTICE("You secure [secured_board] to [turf_ahead]."))
qdel(src)

#undef DOUBLE_BAND
#undef TRIPLE_BAND
8 changes: 2 additions & 6 deletions code/game/objects/structures/signs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
S.desc = desc
S.icon_state = icon_state
S.sign_state = icon_state
S.icon = icon
deconstruct(FALSE)
else ..()

Expand Down Expand Up @@ -45,6 +46,7 @@
S.name = name
S.desc = desc
S.icon_state = sign_state
S.icon = icon
to_chat(user, "You fasten \the [S] with your [tool].")
qdel(src)
else ..()
Expand Down Expand Up @@ -592,9 +594,3 @@
desc = "An unbelievably creepy cat clock that surveys the room with every tick and every tock."
icon = 'icons/obj/structures/props/catclock.dmi'
icon_state = "cat_clock_motion"

/obj/structure/sign/dartboard
name = "dartboard"
desc = "A dartboard, secured with a nail and a string. It has bullet holes and knife stab marks over and around it."
icon = 'icons/obj/structures/props/props.dmi'
icon_state = "dart_board"
Loading

0 comments on commit d23a254

Please sign in to comment.