Files
Bubberstation/code/modules/shuttle/supply.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

131 lines
3.5 KiB
Plaintext

GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
/mob/living,
/obj/structure/blob,
/obj/effect/rune,
/obj/structure/spider/spiderling,
/obj/item/weapon/disk/nuclear,
/obj/machinery/nuclearbomb,
/obj/item/device/radio/beacon,
/obj/singularity,
/obj/machinery/teleport/station,
/obj/machinery/teleport/hub,
/obj/machinery/telepad,
/obj/machinery/quantumpad,
/obj/machinery/clonepod,
/obj/effect/mob_spawn,
/obj/effect/hierophant,
/obj/structure/recieving_pad,
/obj/effect/clockwork/spatial_gateway,
/obj/structure/destructible/clockwork/powered/clockwork_obelisk,
/obj/item/device/warp_cube
)))
/obj/docking_port/mobile/supply
name = "supply shuttle"
id = "supply"
callTime = 600
dir = WEST
port_angle = 90
width = 12
dwidth = 5
height = 7
roundstart_move = "supply_away"
// When TRUE, these vars allow exporting emagged/contraband items, and add some special interactions to existing exports.
var/contraband = FALSE
var/emagged = FALSE
/obj/docking_port/mobile/supply/register()
. = ..()
SSshuttle.supply = src
/obj/docking_port/mobile/supply/canMove()
if(z == ZLEVEL_STATION)
return check_blacklist(areaInstance)
return ..()
/obj/docking_port/mobile/supply/proc/check_blacklist(areaInstance)
for(var/trf in areaInstance)
var/turf/T = trf
for(var/a in T.GetAllContents())
if(is_type_in_typecache(a, GLOB.blacklisted_cargo_types))
return FALSE
return TRUE
/obj/docking_port/mobile/supply/request()
if(mode != SHUTTLE_IDLE)
return 2
return ..()
/obj/docking_port/mobile/supply/dock()
if(getDockedId() == "supply_away") // Buy when we leave home.
buy()
if(..()) // Fly/enter transit.
return
if(getDockedId() == "supply_away") // Sell when we get home
sell()
/obj/docking_port/mobile/supply/proc/buy()
if(!SSshuttle.shoppinglist.len)
return
var/list/empty_turfs = list()
for(var/turf/open/floor/T in areaInstance)
if(is_blocked_turf(T))
continue
empty_turfs += T
var/value = 0
var/purchases = 0
for(var/datum/supply_order/SO in SSshuttle.shoppinglist)
if(!empty_turfs.len)
break
if(SO.pack.cost > SSshuttle.points)
continue
SSshuttle.points -= SO.pack.cost
value += SO.pack.cost
SSshuttle.shoppinglist -= SO
SSshuttle.orderhistory += SO
SO.generate(pick_n_take(empty_turfs))
feedback_add_details("cargo_imports",
"[SO.pack.type]|[SO.pack.name]|[SO.pack.cost]")
investigate_log("Order #[SO.id] ([SO.pack.name], placed by [key_name(SO.orderer_ckey)]) has shipped.", "cargo")
if(SO.pack.dangerous)
message_admins("\A [SO.pack.name] ordered by [key_name_admin(SO.orderer_ckey)] has shipped.")
purchases++
investigate_log("[purchases] orders in this shipment, worth [value] credits. [SSshuttle.points] credits left.", "cargo")
/obj/docking_port/mobile/supply/proc/sell()
var/presale_points = SSshuttle.points
if(!GLOB.exports_list.len) // No exports list? Generate it!
setupExports()
var/msg = ""
var/sold_atoms = ""
for(var/atom/movable/AM in areaInstance)
if(AM.anchored)
continue
sold_atoms += export_item_and_contents(AM, contraband, emagged, dry_run = FALSE)
if(sold_atoms)
sold_atoms += "."
for(var/a in GLOB.exports_list)
var/datum/export/E = a
var/export_text = E.total_printout()
if(!export_text)
continue
msg += export_text + "\n"
SSshuttle.points += E.total_cost
E.export_end()
SSshuttle.centcom_message = msg
investigate_log("Shuttle contents sold for [SSshuttle.points - presale_points] credits. Contents: [sold_atoms || "none."] Message: [SSshuttle.centcom_message || "none."]", "cargo")