From 138d171dbe1ac053276f8e856b8dae467528372a Mon Sep 17 00:00:00 2001
From: ReoDaProtovali <84661000+ReoDaProtovali@users.noreply.github.com>
Date: Wed, 11 Sep 2024 06:28:01 -0500
Subject: [PATCH] Fixed Up everything
Also implemented a new treadmill
---
GainStation13/code/modules/gym/gym.dm | 133 ++++++++++++--------------
code/modules/recycling/conveyor2.dm | 27 ++++--
2 files changed, 79 insertions(+), 81 deletions(-)
diff --git a/GainStation13/code/modules/gym/gym.dm b/GainStation13/code/modules/gym/gym.dm
index c9e94b75..075b2c8a 100644
--- a/GainStation13/code/modules/gym/gym.dm
+++ b/GainStation13/code/modules/gym/gym.dm
@@ -32,82 +32,68 @@
to_chat(user, "You couldn't complete the rep. YOU'LL GET IT NEXT TIME CHAMP!!!")
using = FALSE
-/obj/machinery/conveyor/treadmill
+/obj/machinery/treadmill
name = "treadmill"
desc = "A treadmil, for losing weight!"
-
-/obj/machinery/conveyor/treadmill/convey(list/affecting)
- for(var/am in affecting)
- if(!ismovable(am)) //This is like a third faster than for(var/atom/movable in affecting)
- continue
- var/atom/movable/movable_thing = am
- //Give this a chance to yield if the server is busy
- stoplag()
- if(QDELETED(movable_thing) || (movable_thing.loc != loc))
- continue
- if(iseffect(movable_thing) || isdead(movable_thing))
- continue
- if(isliving(movable_thing))
- var/mob/living/zoommob = movable_thing
- if((zoommob.movement_type & FLYING) && !zoommob.stat)
- continue
- if(!movable_thing.anchored && movable_thing.has_gravity())
- step(movable_thing, movedir)
- if(iscarbon(A))
- var/mob/living/carbon/C = A
- C.adjust_fatness(-10, FATTENING_TYPE_WEIGHT_LOSS)
- conveying = FALSE
-
-/obj/machinery/conveyor/treadmill/attackby(obj/item/I, mob/user, params)
- if(I.tool_behavior == TOOL_CROWBAR)
- user.visible_message("[user] struggles to pry up \the [src] with \the [I].", \
- "You struggle to pry up \the [src] with \the [I].")
- if(I.use_tool(src, user, 40, volume=40))
- if(!(stat & BROKEN))
- var/obj/item/conveyor_construct/treadmill/C = new/obj/item/conveyor_construct/treadmill(src.loc)
- C.id = id
- transfer_fingerprints_to(C)
- to_chat(user, "You remove the conveyor belt.")
- qdel(src)
-
- else if(I.tool_behaviour == TOOL_WRENCH)
- if(!(stat & BROKEN))
- I.play_tool_sound(src)
- setDir(turn(dir,-45))
- update_move_direction()
- to_chat(user, "You rotate [src].")
-
- else if(I.tool_behavior == TOOL_SCREWDRIVER)
- if(!(stat & BROKEN))
- verted = verted * -1
- update_move_direction()
- to_chat(user, "You reverse [src]'s direction.")
-
- else if(user.a_intent != INTENT_HARM)
- user.transferItemToLoc(I, drop_location())
- else
- return ..()
-
-/obj/item/conveyor_construct/treadmill
icon = 'icons/obj/recycling.dmi'
- icon_state = "conveyor_construct"
- name = "treadmill assembly"
- desc = "A treadmill assembly."
- w_class = WEIGHT_CLASS_BULKY
- id = "" //inherited by the belt
+ icon_state = "conveyor0"
+ circuit = /obj/item/circuitboard/machine/treadmill
-/obj/item/conveyor_construct/treadmill/afterattack(atom/A, mob/user, proximity, click_parameters)
- SEND_SIGNAL(src, COMSIG_ITEM_AFTERATTACK, A, user, proximity, click_parameters)
- SEND_SIGNAL(user, COMSIG_MOB_ITEM_AFTERATTACK, A, user, proximity, click_parameters)
- if(!proximity || user.stat || !isfloorturf(A) || istype(A, /area/shuttle))
- return
- var/cdir = get_dir(A, user)
- if(A == user.loc)
- to_chat(user, "You cannot place a conveyor belt under yourself.")
- return
- var/obj/machinery/conveyor/treadmill/C = new/obj/machinery/conveyor/treadmill(A, cdir, id)
- transfer_fingerprints_to(C)
- qdel(src)
+ var/fatloss = -10
+
+/obj/machinery/treadmill/Uncross(atom/movable/AM, atom/newloc)
+ if(stat & BROKEN)
+ return ..()
+ if(!isliving(AM))
+ return ..()
+ var/mob/living/M = AM
+ if(M.throwing || M.floating || M.is_flying()) //Make sure they're not going over it
+ return ..()
+ if(AM.dir != dir) //Make sure they're going into the treadmill
+ return ..()
+ if(prob(25))
+ playsound(src, "sound/machines/tractor_running.ogg", 25, TRUE, -2) //Rumblin'
+ if(iscarbon(M))
+ var/mob/living/carbon/C = M
+ if(C.fatness > FATNESS_LEVEL_BARELYMOBILE)
+ if(prob(5))
+ visible_message(pick(list( //Really testing the poor thing, huh?
+ "\the [src] audibly strains under [C]'s weight...",
+ "\the [src] creeaaaaks under [C]'s strain..."
+ )))
+ C.adjust_fatness(fatloss, FATTENING_TYPE_WEIGHT_LOSS)
+ flick("conveyor-1", src)
+ return FALSE
+
+/obj/machinery/treadmill/RefreshParts(obj/item/O, mob/user, params)
+ for(var/obj/item/stock_parts/manipulator/M in component_parts)
+ fatloss += M.rating * -10
+
+/obj/machinery/treadmill/attackby()
+ if(default_deconstruction_screwdriver(user, "conveyor0", "conveyor0", O))
+ return TRUE
+
+ if(default_deconstruction_crowbar(O))
+ return TRUE
+
+ if(default_change_direction_wrench(O))
+ return TRUE
+
+ return ..()
+
+/obj/item/circuitboard/machine/treadmill
+ name = "Treadmill (Machine Board)"
+ build_path = /obj/machinery/autolathe
+ req_components = list(/obj/item/stock_parts/manipulator = 1)
+
+/datum/design/treadmill
+ name = "Treadmill Board"
+ id = "treadmill"
+ build_type = AUTOLATE | PROTOLATHE
+ materials = list(MAT_METAL = 50, MAT_GLASS = 50)
+ build_path = /obj/item/circuitboard/machine/treadmill
+ category = list("inital", "Construction")
+ departmental_flags = DEPARTMENTAL_FLAG_ENGINEERING
/datum/design/dumbbell
name = "Dumbbell"
@@ -116,7 +102,7 @@
materials = list(MAT_METAL = 2000)
build_path = /obj/item/dumbbell
category = list("initial", "Tools")
-
+/*
/datum/design/treadmill
name = "Treadmill"
id = "treadmill"
@@ -124,3 +110,4 @@
materials = list(MAT_METAL = 5000)
build_path = /obj/item/conveyor_construct/treadmill
category = list("initial", "Construction")
+*/
diff --git a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm
index bbba09ed..6e7c5806 100644
--- a/code/modules/recycling/conveyor2.dm
+++ b/code/modules/recycling/conveyor2.dm
@@ -40,7 +40,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
/obj/machinery/conveyor/inverted //Directions inverted so you can use different corner peices.
icon_state = "conveyor_map_inverted"
- verted = -1
+ inverted = TRUE
/obj/machinery/conveyor/inverted/Initialize(mapload)
. = ..()
@@ -307,12 +307,23 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
CHECK_TICK
/obj/machinery/conveyor_switch/attackby(obj/item/I, mob/user, params)
- if(I.tool_behaviour == TOOL_CROWBAR)
- var/obj/item/conveyor_switch_construct/C = new/obj/item/conveyor_switch_construct(src.loc)
- C.id = id
- transfer_fingerprints_to(C)
- to_chat(user, "You detach the conveyor switch.")
- qdel(src)
+ switch(I.tool_behaviour)
+ if(TOOL_CROWBAR)
+ var/obj/item/conveyor_switch_construct/C = new/obj/item/conveyor_switch_construct(src.loc)
+ C.id = id
+ transfer_fingerprints_to(C)
+ to_chat(user, "You detach the conveyor switch.")
+ qdel(src)
+ if(TOOL_WRENCH)
+ if(position)
+ to_chat(user, span_warning("\The [src] must be off before attempting to change it's direction!"))
+ return FALSE
+ oneway = !oneway
+ I.play_tool_sound(src, 75)
+ user.visible_message("[user] sets \the [src] to [oneway ? "one-way" : "two-way"].",
+ "You set \the [src] to [oneway ? "one-way" : "two-way"].",
+ "You hear a ratchet.")
+
/obj/machinery/conveyor_switch/oneway
icon_state = "conveyor_switch_oneway"
@@ -365,7 +376,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id)
max_amount = 30
singular_name = "conveyor belt"
w_class = WEIGHT_CLASS_BULKY
- materials = list(/datum/material/iron = 1000)
+ materials = list(/datum/material/metal = 1000)
///id for linking
var/id = "" //inherited by the belt