[MIRROR] Reworks gym equipment [MDB IGNORE] (#21300)

* Reworks gym equipment (#75389)

## About The Pull Request

Gym equipment are currently ported from Goon code, and I didn't like how
it currently worked as it was buggy and the code was a mess. I decided
to just rework how they worked entirely. I left the parts that weren't
Goon code (like tooltips & deconstruction) alone because it's not goon
code and I think it's fine that way.

- Now you buckle yourself to it (like a chair, I didn't like how it
didn't work like one) and can work out with an action button you get on
buckle, you can do as many sets as you want, then unbuckle & go.
- You aren't hardstunned for 8 seconds for clicking on it anymore, you
aren't flying around because the stun doesn't even last the duration of
the animation anymore.

Video demonstration

https://github.com/tgstation/tgstation/assets/53777086/f5ae86f1-65fb-46c6-8a5f-8f9d9f0548b3

## Why It's Good For The Game

Reworks old code
Removes un-documented Goon code
Makes gym equipment less broken than it currently is.

## Changelog

🆑
qol: Gym equipment was reworked. You now buckle yourself to weight
machines to use them, rather than clicking on it and getting stunned for
a few seconds. It also means it works like a chair now.
qol: Gym equipment no longer breaks a sweat in no gravity.
/🆑

---------

Co-authored-by: san7890 <the@ san7890.com>

* Reworks gym equipment

* updatepaths

---------

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: san7890 <the@ san7890.com>
Co-authored-by: Jolly-66 <70232195+Jolly-66@users.noreply.github.com>
Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-05-23 17:03:21 +01:00
committed by GitHub
parent ae367ee5d9
commit e2c2ee5eb7
17 changed files with 5611 additions and 5587 deletions
@@ -2558,6 +2558,18 @@
/obj/structure/lattice,
/turf/template_noop,
/area/template_noop)
"kB" = (
/obj/machinery/light/cold/directional/east,
/obj/effect/turf_decal/stripes/red/corner{
dir = 4
},
/obj/effect/turf_decal/stripes/red/corner,
/mob/living/basic/lizard/tegu{
name = "Entertains-The-Hostages"
},
/obj/structure/bed/dogbed,
/turf/open/floor/iron/dark/small,
/area/ruin/space/has_grav/skyrat/interdynefob/security/prison)
"kD" = (
/obj/machinery/smartfridge/food,
/turf/open/floor/iron/dark/smooth_large,
@@ -2651,6 +2663,11 @@
},
/turf/open/floor/iron/dark,
/area/ruin/space/has_grav/skyrat/interdynefob/cargo)
"la" = (
/obj/structure/weightmachine,
/obj/effect/turf_decal/box/white,
/turf/open/floor/iron/dark/textured_large,
/area/ruin/space/has_grav/skyrat/interdynefob/security/prison)
"lb" = (
/obj/structure/table,
/obj/machinery/microwave{
@@ -5059,18 +5076,6 @@
/obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2,
/turf/open/floor/iron/dark,
/area/ruin/space/has_grav/skyrat/interdynefob/halls)
"vN" = (
/obj/machinery/light/cold/directional/east,
/obj/effect/turf_decal/stripes/red/corner{
dir = 4
},
/obj/effect/turf_decal/stripes/red/corner,
/mob/living/basic/lizard/tegu{
name = "Entertains-The-Hostages"
},
/obj/structure/bed/dogbed,
/turf/open/floor/iron/dark/small,
/area/ruin/space/has_grav/skyrat/interdynefob/security/prison)
"vO" = (
/obj/machinery/hydroponics/constructable,
/obj/machinery/door/window/survival_pod{
@@ -6776,11 +6781,6 @@
/obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2,
/turf/open/floor/iron/dark/small,
/area/ruin/space/has_grav/skyrat/interdynefob/security/prison)
"Ew" = (
/obj/structure/weightmachine/stacklifter,
/obj/effect/turf_decal/box/white,
/turf/open/floor/iron/dark/textured_large,
/area/ruin/space/has_grav/skyrat/interdynefob/security/prison)
"Ey" = (
/obj/effect/turf_decal/siding/wood{
dir = 4
@@ -6883,21 +6883,6 @@
/obj/structure/cable,
/turf/open/floor/iron/cafeteria,
/area/ruin/space/has_grav/skyrat/interdynefob/service/diner)
"EV" = (
/obj/structure/weightmachine/stacklifter,
/obj/machinery/light/warm/directional/north,
/obj/effect/turf_decal/tile/neutral/half/contrasted{
dir = 1
},
/obj/effect/turf_decal/trimline/dark/line{
dir = 1
},
/obj/effect/turf_decal/trimline/dark/line{
dir = 1
},
/obj/machinery/firealarm/directional/north,
/turf/open/floor/iron,
/area/ruin/space/has_grav/skyrat/interdynefob/service/dorms/fitness)
"EW" = (
/obj/effect/turf_decal/tile/blue{
dir = 1
@@ -8645,6 +8630,21 @@
/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4,
/turf/open/floor/catwalk_floor/iron_dark,
/area/ruin/space/has_grav/skyrat/interdynefob/research)
"MQ" = (
/obj/structure/weightmachine,
/obj/machinery/light/warm/directional/north,
/obj/effect/turf_decal/tile/neutral/half/contrasted{
dir = 1
},
/obj/effect/turf_decal/trimline/dark/line{
dir = 1
},
/obj/effect/turf_decal/trimline/dark/line{
dir = 1
},
/obj/machinery/firealarm/directional/north,
/turf/open/floor/iron,
/area/ruin/space/has_grav/skyrat/interdynefob/service/dorms/fitness)
"MT" = (
/obj/machinery/computer/shuttle{
desc = "A shuttle terminal which allows a connection to the DS-2 forward base's supply shuttle.";
@@ -11962,7 +11962,7 @@ kx
NB
NB
kF
Ew
la
gA
Vp
Ni
@@ -12074,7 +12074,7 @@ qh
kF
Qx
Po
vN
kB
gi
EZ
UR
@@ -12499,7 +12499,7 @@ wg
cI
qh
NB
EV
MQ
il
AX
Kf
+1 -1
View File
@@ -1763,7 +1763,7 @@
},
/area/awaymission/cabin/caves/mountain)
"fZ" = (
/obj/structure/weightmachine/stacklifter,
/obj/structure/weightmachine,
/obj/effect/decal/cleanable/dirt/dust,
/turf/open/floor/engine,
/area/awaymission/cabin/caves/mountain)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+47 -47
View File
@@ -10981,14 +10981,6 @@
/obj/effect/turf_decal/box/white,
/turf/open/floor/iron/small,
/area/station/commons/dorms)
"dnx" = (
/obj/structure/weightmachine/stacklifter,
/obj/effect/turf_decal/trimline/brown/filled/line{
dir = 5
},
/obj/structure/sign/poster/contraband/random/directional/north,
/turf/open/floor/iron/dark,
/area/station/security/prison)
"dnE" = (
/obj/machinery/airalarm/directional/south,
/obj/structure/closet/l3closet/scientist,
@@ -21485,12 +21477,6 @@
},
/turf/open/floor/iron/showroomfloor,
/area/station/medical/coldroom)
"gjX" = (
/obj/effect/turf_decal/tile/dark/fourcorners,
/mob/living/basic/lizard/eats_the_roaches,
/obj/effect/turf_decal/trimline/green/filled/corner,
/turf/open/floor/noslip,
/area/station/service/janitor)
"gkc" = (
/obj/structure/cable,
/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4,
@@ -25772,12 +25758,6 @@
/obj/effect/turf_decal/siding/purple,
/turf/open/floor/iron/white/smooth_large,
/area/station/command/heads_quarters/rd)
"hvv" = (
/obj/structure/weightmachine/stacklifter,
/obj/effect/turf_decal/tile/yellow/full,
/obj/effect/turf_decal/bot,
/turf/open/floor/iron/white/smooth_large,
/area/station/commons/fitness/recreation/entertainment)
"hvC" = (
/obj/structure/cable,
/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4,
@@ -29021,6 +29001,13 @@
dir = 8
},
/area/station/hallway/secondary/command)
"isL" = (
/obj/structure/weightmachine,
/obj/effect/turf_decal/tile/yellow/full,
/obj/effect/turf_decal/bot,
/obj/effect/landmark/start/assistant,
/turf/open/floor/iron/white/smooth_large,
/area/station/commons/fitness/recreation/entertainment)
"isO" = (
/obj/effect/turf_decal/delivery,
/obj/effect/decal/cleanable/dirt,
@@ -29257,6 +29244,15 @@
/obj/effect/spawner/random/structure/tank_holder,
/turf/open/floor/catwalk_floor/iron_smooth,
/area/station/medical/virology)
"ivG" = (
/mob/living/basic/lizard/wags_his_tail,
/obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2,
/obj/effect/turf_decal/tile/dark/fourcorners,
/obj/machinery/holopad,
/obj/effect/turf_decal/bot,
/obj/effect/landmark/event_spawn,
/turf/open/floor/noslip,
/area/station/service/janitor)
"ivR" = (
/obj/structure/cable,
/obj/effect/spawner/structure/window/reinforced,
@@ -33467,6 +33463,11 @@
/obj/structure/cable,
/turf/open/floor/plating,
/area/station/security/holding_cell)
"jEx" = (
/obj/structure/window/spawner/directional/north,
/mob/living/basic/lizard/tegu/gus,
/turf/open/misc/beach/sand,
/area/station/science/research)
"jEy" = (
/obj/structure/table/wood,
/obj/machinery/status_display/ai/directional/north,
@@ -43987,15 +43988,6 @@
/obj/effect/turf_decal/stripes/corner,
/turf/open/floor/engine,
/area/station/engineering/main)
"myp" = (
/mob/living/basic/lizard/wags_his_tail,
/obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2,
/obj/effect/turf_decal/tile/dark/fourcorners,
/obj/machinery/holopad,
/obj/effect/turf_decal/bot,
/obj/effect/landmark/event_spawn,
/turf/open/floor/noslip,
/area/station/service/janitor)
"myq" = (
/obj/structure/closet/crate/solarpanel_small,
/turf/open/floor/catwalk_floor/iron_smooth,
@@ -47468,6 +47460,12 @@
/obj/structure/bookcase/random/nonfiction,
/turf/open/floor/wood/large,
/area/station/service/library)
"ntf" = (
/obj/effect/turf_decal/tile/dark/fourcorners,
/mob/living/basic/lizard/eats_the_roaches,
/obj/effect/turf_decal/trimline/green/filled/corner,
/turf/open/floor/noslip,
/area/station/service/janitor)
"ntn" = (
/obj/structure/table,
/obj/effect/spawner/random/maintenance,
@@ -55542,13 +55540,6 @@
/obj/machinery/light_switch/directional/east,
/turf/open/floor/iron/smooth,
/area/station/engineering/atmos/storage/gas)
"pFT" = (
/obj/structure/weightmachine/stacklifter,
/obj/effect/turf_decal/tile/yellow/full,
/obj/effect/turf_decal/bot,
/obj/effect/landmark/start/assistant,
/turf/open/floor/iron/white/smooth_large,
/area/station/commons/fitness/recreation/entertainment)
"pGh" = (
/turf/open/floor/iron/white/smooth_large,
/area/station/hallway/primary/fore)
@@ -64699,6 +64690,12 @@
/obj/machinery/light/warm/directional/east,
/turf/open/floor/engine,
/area/station/science/xenobiology)
"shC" = (
/obj/structure/weightmachine,
/obj/effect/turf_decal/tile/yellow/full,
/obj/effect/turf_decal/bot,
/turf/open/floor/iron/white/smooth_large,
/area/station/commons/fitness/recreation/entertainment)
"shE" = (
/obj/effect/mapping_helpers/broken_floor,
/turf/open/floor/iron/smooth,
@@ -74124,11 +74121,6 @@
/obj/effect/spawner/structure/window/reinforced,
/turf/open/floor/plating/airless,
/area/station/engineering/storage_shared)
"uIA" = (
/obj/structure/window/spawner/directional/north,
/mob/living/basic/lizard/tegu/gus,
/turf/open/misc/beach/sand,
/area/station/science/research)
"uIM" = (
/obj/structure/cable,
/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4,
@@ -84256,6 +84248,14 @@
dir = 8
},
/area/station/hallway/secondary/construction)
"xEo" = (
/obj/structure/weightmachine,
/obj/effect/turf_decal/trimline/brown/filled/line{
dir = 5
},
/obj/structure/sign/poster/contraband/random/directional/north,
/turf/open/floor/iron/dark,
/area/station/security/prison)
"xEs" = (
/obj/effect/turf_decal/trimline/blue/line,
/obj/machinery/holopad,
@@ -115384,7 +115384,7 @@ nvL
uMp
ppT
sTo
uIA
jEx
oej
juR
gLD
@@ -121610,7 +121610,7 @@ sgh
pCt
cKW
rkM
hvv
shC
tfF
cPE
jzS
@@ -122383,7 +122383,7 @@ cKW
drm
xcZ
uxS
pFT
isL
gbo
ibt
ibt
@@ -125175,7 +125175,7 @@ qGT
vLe
tFA
mCS
myp
ivG
whl
sEQ
vLe
@@ -125433,7 +125433,7 @@ vLe
rne
egh
hnU
gjX
ntf
akR
vLe
tGn
@@ -136200,7 +136200,7 @@ fxg
fxg
jjS
tHI
dnx
xEo
oVM
grt
grt
@@ -18,7 +18,7 @@
"n" = (
/obj/effect/decal/cleanable/dirt,
/obj/effect/turf_decal/bot_white,
/obj/structure/weightmachine/stacklifter,
/obj/structure/weightmachine,
/turf/open/floor/iron/smooth,
/area/station/maintenance/department/crew_quarters/dorms)
"p" = (
File diff suppressed because it is too large Load Diff
@@ -149,7 +149,7 @@
var/obj/structure/toiletbong/toiletbong = result
// because we want to set the toilet's location and dir, we need to do the consumption manually
var/obj/structure/toilet/toilet = locate(/obj/structure/toilet) in range(1)
var/obj/structure/toilet/toilet = locate(/obj/structure/toilet) in range(1)
if(toilet)
for (var/obj/item/cistern_item in toilet.contents)
cistern_item.forceMove(user.drop_location())
@@ -157,7 +157,7 @@
toiletbong.dir = toilet.dir
toiletbong.loc = toilet.loc
qdel(toilet)
to_chat(user, span_notice("[user] attaches the flamethrower to the repurposed toilet."))
/datum/crafting_recipe/punching_bag
@@ -174,7 +174,7 @@
/datum/crafting_recipe/stacklifter
name = "Chest Press"
result = /obj/structure/weightmachine/stacklifter
result = /obj/structure/weightmachine
tool_behaviors = list(TOOL_SCREWDRIVER)
reqs = list(
/obj/item/stack/sheet/iron = 5,
@@ -195,7 +195,7 @@
)
category = CAT_ENTERTAINMENT
time = 10 SECONDS
/datum/crafting_recipe/latexballoon
name = "Latex Balloon"
result = /obj/item/latexballoon
-193
View File
@@ -1,193 +0,0 @@
/obj/structure/punching_bag
name = "punching bag"
desc = "A punching bag. Can you get to speed level 4???"
icon = 'icons/obj/gym_equipment.dmi'
icon_state = "punchingbag"
anchored = TRUE
layer = WALL_OBJ_LAYER
plane = GAME_PLANE_UPPER
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')
/obj/structure/punching_bag/Initialize(mapload)
. = ..()
AddElement( \
/datum/element/contextual_screentip_bare_hands, \
lmb_text = "Punch", \
)
var/static/list/tool_behaviors = list(
TOOL_CROWBAR = list(
SCREENTIP_CONTEXT_RMB = "Deconstruct",
),
TOOL_WRENCH = list(
SCREENTIP_CONTEXT_RMB = "Anchor",
),
)
AddElement(/datum/element/contextual_screentip_tools, tool_behaviors)
/obj/structure/punching_bag/attack_hand(mob/user, list/modifiers)
. = ..()
if(.)
return
flick("[icon_state]-punch", src)
playsound(loc, pick(hit_sounds), 25, TRUE, -1)
if(isliving(user))
var/mob/living/L = user
L.add_mood_event("exercise", /datum/mood_event/exercise)
L.apply_status_effect(/datum/status_effect/exercised)
/obj/structure/punching_bag/wrench_act_secondary(mob/living/user, obj/item/tool)
tool.play_tool_sound(src)
if(anchored)
balloon_alert(user, "unsecured")
anchored = FALSE
else
balloon_alert(user, "secured")
anchored = TRUE
return TRUE
/obj/structure/punching_bag/crowbar_act_secondary(mob/living/user, obj/item/tool)
if(anchored)
balloon_alert(user, "unsecure first!")
return FALSE
tool.play_tool_sound(src)
balloon_alert(user, "deconstructing...")
if (!do_after(user, 10 SECONDS, target = src))
return FALSE
new /obj/item/stack/sheet/iron(get_turf(src))
new /obj/item/stack/sheet/iron(get_turf(src))
new /obj/item/stack/rods(get_turf(src))
new /obj/item/pillow(get_turf(src))
qdel(src)
return TRUE
/obj/structure/weightmachine
desc = "Just looking at this thing makes you feel tired."
density = TRUE
anchored = TRUE
blocks_emissive = EMISSIVE_BLOCK_UNIQUE
icon = 'icons/obj/gym_equipment.dmi'
/obj/structure/weightmachine/Initialize(mapload)
. = ..()
AddElement( \
/datum/element/contextual_screentip_bare_hands, \
lmb_text = "Work out", \
)
var/static/list/tool_behaviors = list(
TOOL_CROWBAR = list(
SCREENTIP_CONTEXT_RMB = "Deconstruct",
),
TOOL_WRENCH = list(
SCREENTIP_CONTEXT_RMB = "Anchor",
),
)
AddElement(/datum/element/contextual_screentip_tools, tool_behaviors)
/obj/structure/weightmachine/proc/AnimateMachine(mob/living/user)
return
/obj/structure/weightmachine/update_icon_state()
. = ..()
icon_state = (obj_flags & IN_USE) ? "[base_icon_state]-u" : base_icon_state
/obj/structure/weightmachine/update_overlays()
. = ..()
if(obj_flags & IN_USE)
. += mutable_appearance(icon, "[base_icon_state]-o", offset_spokesman = src, plane = GAME_PLANE_UPPER, layer = ABOVE_MOB_LAYER, alpha = src.alpha)
/obj/structure/weightmachine/attack_hand(mob/living/user, list/modifiers)
. = ..()
if(.)
return
if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH))
return
if(obj_flags & IN_USE)
balloon_alert(user, "wait your turn!")
return
else
obj_flags |= IN_USE
update_appearance()
user.setDir(SOUTH)
user.Stun(80)
user.forceMove(src.loc)
var/bragmessage = pick("pushing it to the limit","going into overdrive","burning with determination","rising up to the challenge", "getting strong now","getting ripped")
user.visible_message("<B>[user] is [bragmessage]!</B>")
AnimateMachine(user)
playsound(user, 'sound/machines/click.ogg', 60, TRUE)
obj_flags &= ~IN_USE
update_appearance()
user.pixel_y = user.base_pixel_y
var/finishmessage = pick("You feel stronger!","You feel like you can take on the world!","You feel robust!","You feel indestructible!")
user.add_mood_event("exercise", /datum/mood_event/exercise)
to_chat(user, finishmessage)
user.apply_status_effect(/datum/status_effect/exercised)
/obj/structure/weightmachine/wrench_act_secondary(mob/living/user, obj/item/tool)
tool.play_tool_sound(src)
if(anchored)
balloon_alert(user, "unsecured")
anchored = FALSE
else
balloon_alert(user, "secured")
anchored = TRUE
return TRUE
/obj/structure/weightmachine/crowbar_act_secondary(mob/living/user, obj/item/tool)
if(anchored)
balloon_alert(user, "unsecure first!")
return FALSE
tool.play_tool_sound(src)
balloon_alert(user, "deconstructing...")
if (!do_after(user, 10 SECONDS, target = src))
return FALSE
new /obj/item/stack/sheet/iron/five(get_turf(src))
new /obj/item/stack/rods(get_turf(src))
new /obj/item/stack/rods(get_turf(src))
new /obj/item/chair(get_turf(src))
qdel(src)
return TRUE
/obj/structure/weightmachine/stacklifter
name = "chest press machine"
icon_state = "stacklifter"
base_icon_state = "stacklifter"
/obj/structure/weightmachine/stacklifter/AnimateMachine(mob/living/user)
var/lifts = 0
while (lifts++ < 6)
if (user.loc != src.loc)
break
sleep(0.3 SECONDS)
animate(user, pixel_y = -2, time = 3)
sleep(0.3 SECONDS)
animate(user, pixel_y = -4, time = 3)
sleep(0.2 SECONDS)
playsound(user, 'sound/machines/creak.ogg', 60, TRUE)
/obj/structure/weightmachine/weightlifter
name = "inline bench press"
icon_state = "benchpress"
base_icon_state = "benchpress"
/obj/structure/weightmachine/weightlifter/AnimateMachine(mob/living/user)
var/reps = 0
user.pixel_y = 5
while (reps++ < 6)
if (user.loc != src.loc)
break
for (var/innerReps = max(reps, 1), innerReps > 0, innerReps--)
sleep(0.4 SECONDS)
animate(user, pixel_y = (user.pixel_y == 3) ? 5 : 3, time = 3)
playsound(user, 'sound/machines/creak.ogg', 60, TRUE)
sleep(0.3 SECONDS)
animate(user, pixel_y = 2, time = 3)
sleep(0.3 SECONDS)
@@ -0,0 +1,65 @@
/obj/structure/punching_bag
name = "punching bag"
desc = "A punching bag. Can you get to speed level 4???"
icon = 'icons/obj/gym_equipment.dmi'
icon_state = "punchingbag"
anchored = TRUE
layer = ABOVE_MOB_LAYER
///List of sounds that can be played when punched.
var/static/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',
)
/obj/structure/punching_bag/Initialize(mapload)
. = ..()
AddElement( \
/datum/element/contextual_screentip_bare_hands, \
lmb_text = "Punch", \
)
var/static/list/tool_behaviors = list(
TOOL_CROWBAR = list(
SCREENTIP_CONTEXT_RMB = "Deconstruct",
),
TOOL_WRENCH = list(
SCREENTIP_CONTEXT_RMB = "Anchor",
),
)
AddElement(/datum/element/contextual_screentip_tools, tool_behaviors)
/obj/structure/punching_bag/attack_hand(mob/living/user, list/modifiers)
. = ..()
if(.)
return
flick("[icon_state]-punch", src)
playsound(loc, pick(hit_sounds), 25, TRUE, -1)
user.add_mood_event("exercise", /datum/mood_event/exercise)
user.apply_status_effect(/datum/status_effect/exercised)
/obj/structure/punching_bag/wrench_act_secondary(mob/living/user, obj/item/tool)
tool.play_tool_sound(src)
balloon_alert(user, anchored ? "unsecured" : "secured")
anchored = !anchored
return TRUE
/obj/structure/punching_bag/crowbar_act_secondary(mob/living/user, obj/item/tool)
if(anchored)
balloon_alert(user, "still secured!")
return FALSE
tool.play_tool_sound(src)
balloon_alert(user, "deconstructing...")
if (!do_after(user, 10 SECONDS, target = src))
return FALSE
new /obj/item/stack/sheet/iron(get_turf(src), 2)
new /obj/item/stack/rods(get_turf(src))
new /obj/item/pillow(get_turf(src))
qdel(src)
return TRUE
@@ -0,0 +1,127 @@
/obj/structure/weightmachine
name = "chest press machine"
desc = "Just looking at this thing makes you feel tired."
icon = 'icons/obj/gym_equipment.dmi'
icon_state = "stacklifter"
base_icon_state = "stacklifter"
can_buckle = TRUE
density = TRUE
anchored = TRUE
blocks_emissive = EMISSIVE_BLOCK_UNIQUE
///How much we shift the user's pixel y when using the weight machine.
var/pixel_shift_y = -3
///The weight action we give to people that buckle themselves to us.
var/datum/action/push_weights/weight_action
///List of messages picked when using the machine.
var/static/list/more_weight = list(
"pushing it to the limit!",
"going into overdrive!",
"burning with determination!",
"rising up to the challenge!",
"getting strong now!",
"getting ripped!",
)
///List of messages picked when finished using the machine.
var/static/list/finished_message = list(
"You feel stronger!",
"You feel like you can take on the world!",
"You feel robust!",
"You feel indestructible!",
)
/obj/structure/weightmachine/Initialize(mapload)
. = ..()
weight_action = new(src)
weight_action.weightpress = src
AddElement( \
/datum/element/contextual_screentip_bare_hands, \
lmb_text = "Work out", \
)
var/static/list/tool_behaviors = list(
TOOL_CROWBAR = list(
SCREENTIP_CONTEXT_RMB = "Deconstruct",
),
TOOL_WRENCH = list(
SCREENTIP_CONTEXT_RMB = "Anchor",
),
)
AddElement(/datum/element/contextual_screentip_tools, tool_behaviors)
/obj/structure/weightmachine/Destroy()
QDEL_NULL(weight_action)
return ..()
/obj/structure/weightmachine/buckle_mob(mob/living/buckled, force, check_loc)
. = ..()
weight_action.Grant(buckled)
/obj/structure/weightmachine/unbuckle_mob(mob/living/buckled_mob, force, can_fall)
. = ..()
weight_action.Remove(buckled_mob)
/obj/structure/weightmachine/wrench_act_secondary(mob/living/user, obj/item/tool)
tool.play_tool_sound(src)
balloon_alert(user, anchored ? "unsecured" : "secured")
anchored = !anchored
return TRUE
/obj/structure/weightmachine/crowbar_act_secondary(mob/living/user, obj/item/tool)
if(anchored)
balloon_alert(user, "still secured!")
return FALSE
tool.play_tool_sound(src)
balloon_alert(user, "deconstructing...")
if (!do_after(user, 10 SECONDS, target = src))
return FALSE
new /obj/item/stack/sheet/iron(get_turf(src), 5)
new /obj/item/stack/rods(get_turf(src), 2)
new /obj/item/chair(get_turf(src))
qdel(src)
return TRUE
/obj/structure/weightmachine/proc/perform_workout(mob/living/user)
user.balloon_alert_to_viewers("[pick(more_weight)]")
START_PROCESSING(SSobj, src)
if(do_after(user, 8 SECONDS, src) && user.has_gravity())
user.Stun(2 SECONDS)
user.balloon_alert(user, pick(finished_message))
user.add_mood_event("exercise", /datum/mood_event/exercise)
user.apply_status_effect(/datum/status_effect/exercised)
end_workout()
/obj/structure/weightmachine/proc/end_workout()
playsound(src, 'sound/machines/click.ogg', 60, TRUE)
STOP_PROCESSING(SSobj, src)
icon_state = initial(icon_state)
/obj/structure/weightmachine/process(seconds_per_tick)
if(!has_buckled_mobs())
end_workout()
return FALSE
var/image/workout_icon = new(icon, src, "[base_icon_state]-o", ABOVE_MOB_LAYER)
workout_icon.plane = GAME_PLANE_UPPER
flick_overlay_view(workout_icon, 8)
flick("[base_icon_state]-u", src)
var/mob/living/user = buckled_mobs[1]
animate(user, pixel_y = pixel_shift_y, time = 4)
playsound(user, 'sound/machines/creak.ogg', 60, TRUE)
animate(pixel_y = user.base_pixel_y, time = 4)
return TRUE
/**
* Weight lifter subtype
*/
/obj/structure/weightmachine/weightlifter
name = "inline bench press"
icon_state = "benchpress"
base_icon_state = "benchpress"
pixel_shift_y = 5
@@ -0,0 +1,22 @@
/**
* The action button given by the weight machine's buckle.
* This allows users to manually trigger working out.
*/
/datum/action/push_weights
name = "Work out"
desc = "Start working out"
button_icon = 'icons/obj/gym_equipment.dmi'
button_icon_state = "stacklifter"
///Reference to the weightpress we are created inside of.
var/obj/structure/weightmachine/weightpress
/datum/action/push_weights/IsAvailable(feedback = FALSE)
if(DOING_INTERACTION(owner, weightpress))
return FALSE
return TRUE
/datum/action/push_weights/Trigger(trigger_flags)
. = ..()
if(!.)
return FALSE
weightpress.perform_workout(owner)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

+3 -1
View File
@@ -2229,7 +2229,6 @@
#include "code\game\objects\structures\grille.dm"
#include "code\game\objects\structures\guillotine.dm"
#include "code\game\objects\structures\guncase.dm"
#include "code\game\objects\structures\gym.dm"
#include "code\game\objects\structures\headpike.dm"
#include "code\game\objects\structures\hivebot.dm"
#include "code\game\objects\structures\holosign.dm"
@@ -2312,6 +2311,9 @@
#include "code\game\objects\structures\crates_lockers\crates\secure.dm"
#include "code\game\objects\structures\crates_lockers\crates\syndicrate.dm"
#include "code\game\objects\structures\crates_lockers\crates\wooden.dm"
#include "code\game\objects\structures\gym\punching_bag.dm"
#include "code\game\objects\structures\gym\weight_machine.dm"
#include "code\game\objects\structures\gym\weight_machine_action.dm"
#include "code\game\objects\structures\icemoon\cave_entrance.dm"
#include "code\game\objects\structures\lavaland\geyser.dm"
#include "code\game\objects\structures\lavaland\necropolis_tendril.dm"
@@ -0,0 +1 @@
/obj/structure/weightmachine/stacklifter : /obj/structure/weightmachine