Skip to content

Commit

Permalink
Constructable exercise equipment (shiptest-ss13#2839)
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. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request

<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

- Punching bags can now be constructed from 5 cloth and deconstructed
with a wirecutter.
- Bench presses and chest presses can be constructed from 5 metal and
deconstructed with a wrench.
## Why It's Good For The Game

<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding. -->
You no longer need to smash apart the exercise equipment like a caveman,
and offers players some more freedom in how they want to decorate or
arrange their ships.


## Changelog

:cl:
add: Punching bags can be built with 5 cloth.
add: Bench press and chest press can be built with 5 metal.
add: Exercise equipment can be deconstructed.
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
Gristlebee authored and MysticalFaceLesS committed Apr 12, 2024
1 parent 924a5bc commit 4550aa9
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 1 deletion.
5 changes: 5 additions & 0 deletions code/game/objects/items/stacks/sheets/sheet_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ GLOBAL_LIST_INIT(metal_recipes, list ( \
new/datum/stack_recipe("mortar", /obj/item/reagent_containers/glass/mortar/metal, 3), \
new/datum/stack_recipe("pestle", /obj/item/pestle, 1, time = 50), \
new/datum/stack_recipe("hygienebot assembly", /obj/item/bot_assembly/hygienebot, 2, time = 50), \
new/datum/stack_recipe_list("weight machines", list( \
new/datum/stack_recipe("chest press", /obj/structure/weightmachine/stacklifter, 5, time = 25, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("bench press", /obj/structure/weightmachine/weightlifter, 5, time = 25, one_per_turf = TRUE, on_floor = TRUE), \
)), \
new/datum/stack_recipe("shower", /obj/machinery/shower, 3, time = 25)
))

Expand Down Expand Up @@ -367,6 +371,7 @@ GLOBAL_LIST_INIT(cloth_recipes, list ( \
new/datum/stack_recipe("19x19 canvas", /obj/item/canvas/nineteenXnineteen, 3), \
new/datum/stack_recipe("23x19 canvas", /obj/item/canvas/twentythreeXnineteen, 4), \
new/datum/stack_recipe("23x23 canvas", /obj/item/canvas/twentythreeXtwentythree, 5), \
new/datum/stack_recipe("punching bag", /obj/structure/punching_bag, 5, time = 25, one_per_turf = TRUE, on_floor = TRUE), \
))

/obj/item/stack/sheet/cotton/cloth
Expand Down
85 changes: 84 additions & 1 deletion code/modules/mining/lavaland/ruins/gym.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,47 @@
layer = WALL_OBJ_LAYER
var/list/hit_sounds = list('sound/weapons/genhit1.ogg', 'sound/weapons/genhit2.ogg', 'sound/weapons/genhit3.ogg',\
'sound/weapons/punch1.ogg', 'sound/weapons/punch2.ogg', 'sound/weapons/punch3.ogg', 'sound/weapons/punch4.ogg')
var/buildstacktype = /obj/item/stack/sheet/cotton/cloth
var/buildstackamount = 5

/obj/structure/punching_bag/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))
if(buildstacktype)
new buildstacktype(loc,buildstackamount)
return..()

/obj/structure/punching_bag/wrench_act(mob/living/user, obj/item/W)
if(..())
return TRUE
add_fingerprint(user)
var/action = anchored ? "unbolts [src] from" : "bolts [src] to"
var/uraction = anchored ? "unbolt [src] from" : "bolt [src] to"
user.visible_message(span_warning("[user] [action] the floor."), span_notice("You start to [uraction] the floor..."), span_hear("You hear rustling noises."))
if(W.use_tool(src, user, 50, volume=100, extra_checks = CALLBACK(src, PROC_REF(check_anchored_state), anchored)))
set_anchored(!anchored)
to_chat(user, span_notice("You [anchored ? "bolt" : "unbolt"] [src] from the floor."))
return TRUE

/obj/structure/punching_bag/wirecutter_act(mob/living/user, obj/item/W)
. = ..()
if(!anchored)
user.visible_message(span_warning("[user] cuts apart [src]."), span_notice("You start to cut apart [src]."), span_hear("You hear cutting."))
if(W.use_tool(src, user, 50, volume=100))
if(anchored)
return TRUE
to_chat(user, span_notice("You cut apart [src]."))
deconstruct(TRUE)
return TRUE

/obj/structure/punching_bag/proc/check_anchored_state(check_anchored)
return anchored == check_anchored

/obj/structure/punching_bag/examine(mob/user)
. = ..()
if(anchored)
. += span_notice("[src] is <b>bolted</b> to the floor.")
else
. += span_notice("[src] is no longer <i>bolted</i> to the floor, and the seams can be <b>cut</b> apart.")

/obj/structure/punching_bag/attack_hand(mob/user as mob)
. = ..()
Expand All @@ -25,6 +66,8 @@
icon = 'icons/obj/gym_equipment.dmi'
density = TRUE
anchored = TRUE
var/buildstacktype = /obj/item/stack/sheet/metal
var/buildstackamount = 5

/obj/structure/weightmachine/proc/AnimateMachine(mob/living/user)
return
Expand All @@ -33,6 +76,45 @@
. = ..()
icon_state = (obj_flags & IN_USE) ? "[base_icon_state]-u" : base_icon_state

/obj/structure/weightmachine/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))
if(buildstacktype)
new buildstacktype(loc,buildstackamount)
return..()

/obj/structure/weightmachine/wrench_act(mob/living/user, obj/item/W)
if(..())
return TRUE
add_fingerprint(user)
var/action = anchored ? "unbolts [src] from" : "bolts [src] to"
var/uraction = anchored ? "unbolt [src] from" : "bolt [src] to"
user.visible_message(span_warning("[user] [action] the floor."), span_notice("You start to [uraction] the floor..."), span_hear("You hear rustling noises."))
if(W.use_tool(src, user, 50, volume=100, extra_checks = CALLBACK(src, PROC_REF(check_anchored_state), anchored)))
set_anchored(!anchored)
to_chat(user, span_notice("You [anchored ? "bolt" : "unbolt"] [src] from the floor."))
return TRUE

/obj/structure/weightmachine/screwdriver_act(mob/living/user, obj/item/W)
. = ..()
if(!anchored)
user.visible_message(span_warning("[user] screws apart [src]."), span_notice("You start to screw apart [src]."), span_hear("You hear screwing."))
if(W.use_tool(src, user, 50, volume=100))
if(anchored)
return TRUE
to_chat(user, span_notice("You screw apart [src]."))
deconstruct(TRUE)
return TRUE

/obj/structure/weightmachine/proc/check_anchored_state(check_anchored)
return anchored == check_anchored

/obj/structure/weightmachine/examine(mob/user)
. = ..()
if(anchored)
. += span_notice("[src] is <b>bolted</b> to the floor.")
else
. += span_notice("[src] is no longer <i>bolted</i> to the floor, and the <b>screws</b> are exposed.")

/obj/structure/weightmachine/update_overlays()
. = ..()

Expand All @@ -44,7 +126,7 @@
if(.)
return
if(obj_flags & IN_USE)
to_chat(user, "<span class='warning'>It's already in use - wait a bit!</span>")
to_chat(user, span_warning("It's already in use - wait a bit!"))
return
else
obj_flags |= IN_USE
Expand Down Expand Up @@ -100,3 +182,4 @@
sleep(3)
animate(user, pixel_y = 2, time = 3)
sleep(3)

0 comments on commit 4550aa9

Please sign in to comment.