Files
Bubberstation/code/modules/mining/laborcamp/laborstacker.dm
Cyberboss 9e1ef0ffe2 Global variable wrappers (#25325)
* Add the system for managed global variables

* Travis ban old globals

* So you CAN inline proccall, that's neat

* Fix that

* master.dm

* Remove the hack procs

* Move InitGlobals to the proper spot

* configuration.dm

* Fix the missing pre-slash

* clockcult.dm

* This is probably for the best

* Doy

* Fix shit

* Rest of the DEFINES tree

* Fix

* Use global. for access

* Update find_references_in_globals

Always hated that proc

Whoever made it must've bee a r e a l idiot...

* __HELPERS tree

* Move global initialization to master.

Fix the declaration

* database.dm

* Dat newline

* I said DECLARATIVE order!

* Here's something you can chew on @Iamgoofball

* game_modes.dm

* Fix this

* genetics.dm

* flavor_misc.dm

* More stuff

* Do it mso's way. Keep the controllers as global

* Make master actually see it

* Fix

* Finish _globalvars/lists

* Finish the rest of the _globalvars tree

* This is weird

* Migrate the controllers

* SLOTH -> GLOB

* Lighting globals

* round_start_time -> ticker

* PAI card list -> pai SS

* record_id_num -> static

* Diseases list -> SSdisease

* More disease globals to the SS

* More disease stuff

* Emote list

* Better and better

* Bluh

* So much stuff

* Ahh

* Wires

* dview

* station_areas

* Teleportlocs

* blood_splatter_icons

* Stuff and such

* More stuff

* RAD IO

* More stuff and such

* Blob shit

* Changeling stuff

* Add "Balance" to changelogs

* Balance for changelog compiler + Auto Tagging

* Update the PR template

* hivemind_bank

* Bip

* sacrificed

* Good shit

* Better define

* More cult shit

* Devil shit

* Gang shit

* > borers

Fix shit

* Rename the define

* Nuke

* Objectives

* Sandbox

* Multiverse sword

* Announce systems

* Stuff and such

* TC con

* Airlock

* doppllllerrrrrr

* holopads

* Shut up byond you inconsistent fuck

* Sneaky fuck

* Burp

* Bip

* Fixnshit

* Port without regard

* askdlfjs;

* asdfjasoidojfi

* Protected globals and more

* SO MANY

* ajsimkvahsaoisd

* akfdsiaopwimfeoiwafaw

* gsdfigjosidjfgiosdg

* AHHHHHHHHHHHHHHHHHHHHHHH!!!!!

* facerolll

* ASDFASDFASDF

* Removes the unused parts of dmm_suite

* WIP

* Fix quote

* asdfjauwfnkjs

* afwlunhskjfda

* asfjlaiwuefhaf

* SO CLOSE

* wwwweeeeeewwwww

* agdgmoewranwg

* HOLY MOTHER OF FUCK AND THATS JUST HALF THE JOB?!?

* Fix syntax errors

* 100 errors

* Another 100

* So many...

* Ugh

* More shit

* kilme

* Stuuuuuufffff

* ajrgmrlshio;djfa;sdkl

* jkbhkhjbmjvjmh

* soi soi soi

* butt

* TODAY WE LEARNED THAT GLOBAL AND STATIC ARE THE EXACT SAME FUCKING THING

* lllllllllllllllllllllllllllllllllllllllllll

* afsdijfiawhnflnjhnwsdfs

* yugykihlugk,kj

* time to go

* STUFFF!!!

* AAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!

* ngoaijdjlfkamsdlkf

* Break time

* aufjsdklfalsjfi

* CONTROL KAY AND PRAY

* IT COMPILEELEELELAKLJFKLDAFJLKFDJLADKJHFLJKAJGAHIEJALDFJ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

* Goteem

* Fix testing mode

* This does not belong in this PR

* Convert it to a controller

* Eh, fuck this option

* Revert controllerization Ill do it some other time

* Fix

* Working controllerization

* FOR THE LOVE OF CHRIST PROTECT THE LOGS

* Protect admins and deadmins

* Use the inbuilt proc
2017-04-06 23:26:13 -06:00

169 lines
6.3 KiB
Plaintext

/**********************Prisoners' Console**************************/
/obj/machinery/mineral/labor_claim_console
name = "point claim console"
desc = "A stacking console with an electromagnetic writer, used to track ore mined by prisoners."
icon = 'icons/obj/machines/mining_machines.dmi'
icon_state = "console"
density = 0
anchored = 1
var/obj/machinery/mineral/stacking_machine/laborstacker/stacking_machine = null
var/machinedir = SOUTH
var/obj/item/weapon/card/id/prisoner/inserted_id
var/obj/machinery/door/airlock/release_door
var/door_tag = "prisonshuttle"
var/obj/item/device/radio/Radio //needed to send messages to sec radio
/obj/machinery/mineral/labor_claim_console/New()
..()
Radio = new/obj/item/device/radio(src)
Radio.listening = 0
addtimer(CALLBACK(src, .proc/locate_stacking_machine), 7)
/obj/machinery/mineral/labor_claim_console/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/weapon/card/id/prisoner))
if(!inserted_id)
if(!user.drop_item())
return
I.forceMove(src)
inserted_id = I
to_chat(user, "<span class='notice'>You insert [I].</span>")
return
else
to_chat(user, "<span class='notice'>There's an ID inserted already.</span>")
return ..()
/obj/machinery/mineral/labor_claim_console/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "labor_claim_console", name, 450, 475, master_ui, state)
ui.open()
/obj/machinery/mineral/labor_claim_console/ui_data(mob/user)
var/list/data = list()
var/can_go_home = FALSE
data["emagged"] = emagged
if(inserted_id)
data["id"] = inserted_id
data["id_name"] = inserted_id.registered_name
data["points"] = inserted_id.points
data["goal"] = inserted_id.goal
if(check_auth())
can_go_home = TRUE
var/list/ores = list()
if(stacking_machine)
data["unclaimed_points"] = stacking_machine.points
for(var/ore in stacking_machine.ore_values)
var/list/O = list()
O["ore"] = ore
O["value"] = stacking_machine.ore_values[ore]
ores += list(O)
data["ores"] = ores
data["can_go_home"] = can_go_home
return data
/obj/machinery/mineral/labor_claim_console/ui_act(action, params)
if(..())
return
switch(action)
if("handle_id")
if(inserted_id)
if(!usr.get_active_held_item())
usr.put_in_hands(inserted_id)
inserted_id = null
else
inserted_id.forceMove(get_turf(src))
inserted_id = null
else
var/obj/item/I = usr.get_active_held_item()
if(istype(I, /obj/item/weapon/card/id/prisoner))
if(!usr.drop_item())
return
I.forceMove(src)
inserted_id = I
if("claim_points")
inserted_id.points += stacking_machine.points
stacking_machine.points = 0
to_chat(usr, "Points transferred.")
if("move_shuttle")
if(!alone_in_area(get_area(src), usr))
to_chat(usr, "<span class='warning'>Prisoners are only allowed to be released while alone.</span>")
else
switch(SSshuttle.moveShuttle("laborcamp","laborcamp_home"))
if(1)
to_chat(usr, "<span class='notice'>Shuttle not found</span>")
if(2)
to_chat(usr, "<span class='notice'>Shuttle already at station</span>")
if(3)
to_chat(usr, "<span class='notice'>No permission to dock could be granted.</span>")
else
if(!emagged)
Radio.set_frequency(GLOB.SEC_FREQ)
Radio.talk_into(src, "[inserted_id.registered_name] has returned to the station. Minerals and Prisoner ID card ready for retrieval.", GLOB.SEC_FREQ, get_spans(), get_default_language())
to_chat(usr, "<span class='notice'>Shuttle received message and will be sent shortly.</span>")
/obj/machinery/mineral/labor_claim_console/proc/check_auth()
if(emagged)
return 1 //Shuttle is emagged, let any ol' person through
return (istype(inserted_id) && inserted_id.points >= inserted_id.goal) //Otherwise, only let them out if the prisoner's reached his quota.
/obj/machinery/mineral/labor_claim_console/proc/locate_stacking_machine()
stacking_machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir))
if(stacking_machine)
stacking_machine.CONSOLE = src
else
qdel(src)
/obj/machinery/mineral/labor_claim_console/emag_act(mob/user)
if(!emagged)
emagged = 1
to_chat(user, "<span class='warning'>PZZTTPFFFT</span>")
/**********************Prisoner Collection Unit**************************/
/obj/machinery/mineral/stacking_machine/laborstacker
var/points = 0 //The unclaimed value of ore stacked. Value for each ore loosely relative to its rarity.
var/list/ore_values = list("glass" = 1, "metal" = 2, "solid plasma" = 20, "plasteel" = 23, "reinforced glass" = 4, "gold" = 20, "silver" = 20, "uranium" = 20, "diamond" = 25, "bananium" = 50)
/obj/machinery/mineral/stacking_machine/laborstacker/process_sheet(obj/item/stack/sheet/inp)
if(istype(inp))
var/n = inp.name
var/a = inp.amount
if(n in ore_values)
points += ore_values[n] * a
..()
/**********************Point Lookup Console**************************/
/obj/machinery/mineral/labor_points_checker
name = "points checking console"
desc = "A console used by prisoners to check the progress on their quotas. Simply swipe a prisoner ID."
icon = 'icons/obj/machines/mining_machines.dmi'
icon_state = "console"
density = 0
anchored = 1
/obj/machinery/mineral/labor_points_checker/attack_hand(mob/user)
user.examinate(src)
/obj/machinery/mineral/labor_points_checker/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/weapon/card/id))
if(istype(I, /obj/item/weapon/card/id/prisoner))
var/obj/item/weapon/card/id/prisoner/prisoner_id = I
to_chat(user, "<span class='notice'><B>ID: [prisoner_id.registered_name]</B></span>")
to_chat(user, "<span class='notice'>Points Collected:[prisoner_id.points]</span>")
to_chat(user, "<span class='notice'>Point Quota: [prisoner_id.goal]</span>")
to_chat(user, "<span class='notice'>Collect points by bringing smelted minerals to the Labor Shuttle stacking machine. Reach your quota to earn your release.</span>")
else
to_chat(user, "<span class='warning'>Error: Invalid ID</span>")
else
return ..()