From 1665a160c455b7e0557c5b18d322d74f4190d646 Mon Sep 17 00:00:00 2001
From: Pinta <>
Date: Tue, 13 Feb 2024 23:49:25 -0500
Subject: [PATCH] main code
---
.../code/mechanics/den abductors/console.dm | 201 ++++++++++++++++++
tgstation.dme | 1 +
2 files changed, 202 insertions(+)
create mode 100644 GainStation13/code/mechanics/den abductors/console.dm
diff --git a/GainStation13/code/mechanics/den abductors/console.dm b/GainStation13/code/mechanics/den abductors/console.dm
new file mode 100644
index 00000000..4bdc63c0
--- /dev/null
+++ b/GainStation13/code/mechanics/den abductors/console.dm
@@ -0,0 +1,201 @@
+/obj/machinery/abductor/feeder_console
+ name = "feeder console"
+ desc = "Get people fat."
+ icon = 'icons/obj/abductor.dmi'
+ icon_state = "console"
+ density = TRUE
+ team_number = 27 // 6(F) + 1(A) + 20(T) :3
+ /// What pad is linked with the console?
+ var/obj/machinery/abductor/pad/pad
+ /// What camera console is linked with the console?
+ var/obj/machinery/computer/camera_advanced/abductor/camera
+ /// What abductor gizmo is linked with the console?
+ var/obj/item/abductor/gizmo/gizmo
+ /// The current scale linked with the console
+ var/obj/structure/scale/credits/linked_scale
+
+/obj/machinery/abductor/feeder_console/attack_hand(mob/user)
+ . = ..()
+ if(.)
+ return
+ user.set_machine(src)
+ var/dat = ""
+ dat += "
FeederSoft 3000
"
+
+ var/credits = linked_scale.credits
+ dat += "Gear Credits: [credits]
"
+ dat += "Transfer data in exchange for supplies:
"
+ dat += "Nutri-Pump TURBO Autosurgeon
"
+ dat += "Meal Vendor Refill
"
+ dat += "Advanced Baton
"
+ dat += "Science Tool
"
+ dat += "Chameleon Kit
"
+ dat += "Banana Cream Pie Cannon
"
+ dat += "Thermal Imaging Glasses
"
+ dat += "Reagent Gun
"
+ dat += "Protolathe Kit
"
+
+ if(pad)
+ dat += "Emergency Teleporter System."
+ dat += "Consider using primary observation console first."
+ dat += "Activate Teleporter
"
+ if(gizmo && gizmo.marked)
+ dat += "Retrieve Mark
"
+ else
+ dat += "Retrieve Mark
"
+ else
+ dat += "NO TELEPAD DETECTED"
+
+ var/datum/browser/popup = new(user, "computer", "Abductor Console", 400, 500)
+ popup.set_content(dat)
+ popup.open()
+
+/obj/machinery/abductor/feeder_console/Topic(href, href_list)
+ if(..())
+ return
+
+ usr.set_machine(src)
+ if(href_list["teleporter_send"])
+ TeleporterSend()
+ if(href_list["dispense"])
+ switch(href_list["dispense"])
+ if("baton")
+ Dispense(/obj/item/abductor_baton, cost=300)
+ if("tool")
+ Dispense(/obj/item/abductor/gizmo, cost=120)
+ if("nutripump_turbo")
+ Dispense(/obj/item/autosurgeon/nutripump_turbo, cost=150)
+ if("vendor_refill")
+ Dispense(/obj/item/vending_refill/mealdor, cost=100)
+ if("chameleon")
+ Dispense(/obj/item/storage/box/syndie_kit/chameleon, cost=300)
+ if("pie_canon")
+ Dispense(/obj/item/pneumatic_cannon/pie/selfcharge, cost=500)
+ if("thermals")
+ Dispense(/obj/item/autosurgeon/thermal_eyes, cost=400)
+ if("reagent_gun")
+ Dispense(/obj/item/autosurgeon/thermal_eyes, cost=500)
+ if("protolathe_kit")
+ Dispense(/obj/item/storage/box/rndboards, cost=1500)
+
+ updateUsrDialog()
+
+/obj/machinery/abductor/feeder_console/proc/TeleporterRetrieve()
+ if(pad && gizmo && gizmo.marked)
+ pad.Retrieve(gizmo.marked)
+
+/obj/machinery/abductor/feeder_console/proc/TeleporterSend()
+ if(pad)
+ pad.Send()
+
+/obj/machinery/abductor/feeder_console/proc/SetDroppoint(turf/open/location,user)
+ if(!istype(location))
+ to_chat(user, "That place is not safe for the specimen.")
+ return
+
+ if(pad)
+ pad.teleport_target = location
+ to_chat(user, "Location marked as test subject release point.")
+
+
+/obj/machinery/abductor/feeder_console/Initialize(mapload)
+ ..()
+ return INITIALIZE_HINT_LATELOAD
+
+/obj/machinery/abductor/feeder_console/LateInitialize()
+ if(!team_number)
+ return
+
+ for(var/obj/machinery/abductor/pad/found_pad in GLOB.machines)
+ if(found_pad.team_number == team_number)
+ pad = found_pad
+ break
+
+ for(var/obj/machinery/computer/camera_advanced/abductor/found_console in GLOB.machines)
+ if(found_console.team_number == team_number)
+ camera = found_console
+ found_console.console = src
+
+/obj/machinery/abductor/feeder_console/proc/AddGizmo(obj/item/abductor/gizmo/G)
+ if(G == gizmo && G.console == src)
+ return FALSE
+
+ if(G.console)
+ G.console.gizmo = null
+
+ gizmo = G
+ G.console = src
+ return TRUE
+
+/obj/machinery/abductor/feeder_console/proc/Dispense(obj/item/new_item, cost = 1)
+ if(!linked_scale?.credits || !linked_scale.credits < cost)
+ say("Insufficent data!")
+ return TRUE
+
+ linked_scale.credits -= cost
+ say("Incoming supply!")
+ var/drop_location = loc
+
+ if(pad)
+ flick("alien-pad", pad)
+ drop_location = pad.loc
+
+ new new_item(drop_location)
+ return TRUE
+
+/obj/machinery/abductor/feeder_console/attackby(obj/item/used_tool, mob/user, params)
+ if(istype(used_tool, /obj/item/abductor/gizmo) && AddGizmo(used_tool))
+ to_chat(user, "You link the tool to the console.")
+ return TRUE
+
+ return ..()
+
+/obj/structure/scale/credits
+ name = "tracking scale"
+ desc = "A upgraded scale that tracks to weight of all of those that have stepped on it."
+ resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF
+ flags_1 = NODECONSTRUCT_1
+ /// How much credits do we currently have?
+ var/credits = 0
+ /// How many credits are we going to reward per pound gained?
+ var/credits_per_pound = 0.25
+ /// A list containing all of the people we've scanned and their maximum weight.
+ var/list/scanned_people = list()
+ /// What is the current team number?
+ var/team_number = 27
+
+/obj/structure/scale/credits/attackby(obj/item/used_tool, mob/user, params)
+ if(!istype(used_tool, /obj/item/wrench))
+ return ..()
+
+ anchored = !anchored
+ to_chat(user, "You [anchored ? "secure" : "unsecure"] \the [src].")
+ used_tool.play_tool_sound(src)
+ return TRUE
+
+/obj/structure/scale/credits/LateInitialize()
+ for(var/obj/machinery/abductor/feeder_console/found_console in GLOB.machines)
+ if(found_console.team_number != team_number)
+ continue
+
+ found_console.linked_scale = src
+
+/obj/structure/scale/credits/weighperson(mob/living/carbon/human/fatty)
+ . = ..()
+ if(!istype(fatty))
+ return FALSE
+
+ var/credits_to_add = ((lastreading * credits_per_pound) * fatnessToWeight)
+ var/credits_to_remove = 0
+ if(scanned_people[fatty])
+ credits_to_remove = scanned_people[fatty]
+
+ credits += (credits_to_add - credits_to_remove)
+ scanned_people[fatty] = max(credits_to_add, credits_to_remove)
+ return TRUE
+
+/obj/machinery/abductor/pad/feeder
+ team_number = 27
+
+/obj/machinery/computer/camera_advanced/abductor/camera/feeder
+ team_number = 27
diff --git a/tgstation.dme b/tgstation.dme
index 9159dda6..fbe1dbe5 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -3086,6 +3086,7 @@
#include "GainStation13\code\mechanics\spells.dm"
#include "GainStation13\code\mechanics\wand.dm"
#include "GainStation13\code\mechanics\web_weaving.dm"
+#include "GainStation13\code\mechanics\den abductors\console.dm"
#include "GainStation13\code\mobs\cakegolem.dm"
#include "GainStation13\code\mobs\chocoslime.dm"
#include "GainStation13\code\mobs\races\caloritegolem.dm"