mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Merge branch 'master' of https://github.com/VOREStation/Polaris into sync-09272018
# Conflicts: # code/__defines/holomap.dm # code/__defines/mobs.dm # code/_helpers/icons.dm # code/_helpers/unsorted.dm # code/_onclick/hud/hud.dm # code/_onclick/item_attack.dm # code/controllers/Processes/supply.dm # code/controllers/subsystems/planets.dm # code/datums/supplypacks/munitions.dm # code/datums/supplypacks/science.dm # code/datums/supplypacks/security.dm # code/datums/supplypacks/supply.dm # code/game/area/Space Station 13 areas.dm # code/game/atoms_movable.dm # code/game/machinery/autolathe.dm # code/game/machinery/doors/door.dm # code/game/machinery/jukebox.dm # code/game/machinery/recharger.dm # code/game/machinery/vending.dm # code/game/mecha/equipment/tools/medical_tools.dm # code/game/mecha/equipment/weapons/weapons.dm # code/game/objects/items/devices/PDA/PDA.dm # code/game/objects/items/devices/megaphone.dm # code/game/objects/items/poi_items.dm # code/game/objects/items/weapons/implants/implantlanguage.dm # code/game/objects/items/weapons/storage/firstaid.dm # code/game/objects/items/weapons/tools/weldingtool.dm # code/game/objects/structures/flora/trees.dm # code/game/objects/structures/plasticflaps.dm # code/game/supplyshuttle.dm # code/game/turfs/simulated/wall_attacks.dm # code/modules/admin/admin_verbs.dm # code/modules/assembly/infrared.dm # code/modules/client/client procs.dm # code/modules/client/preference_setup/loadout/loadout_utility.dm # code/modules/client/preferences.dm # code/modules/clothing/suits/miscellaneous.dm # code/modules/holomap/holomap_datum.dm # code/modules/holomap/station_holomap.dm # code/modules/integrated_electronics/core/printer.dm # code/modules/mining/machine_processing.dm # code/modules/mob/living/carbon/human/human_defense.dm # code/modules/mob/living/carbon/human/species/virtual_reality/avatar.dm # code/modules/mob/living/death.dm # code/modules/mob/living/silicon/ai/ai.dm # code/modules/mob/living/silicon/pai/pai.dm # code/modules/mob/living/silicon/robot/robot.dm # code/modules/mob/living/simple_animal/animals/parrot.dm # code/modules/mob/mob_movement.dm # code/modules/organs/organ_external.dm # code/modules/organs/organ_icon.dm # code/modules/organs/subtypes/standard.dm # code/modules/planet/weather.dm # code/modules/power/cable.dm # code/modules/power/fusion/core/core_control.dm # code/modules/power/fusion/fuel_assembly/fuel_control.dm # code/modules/power/fusion/gyrotron/gyrotron_control.dm # code/modules/projectiles/gun.dm # code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm # config/names/first_name_skrell.txt # config/names/last_name_skrell.txt # icons/mob/head.dmi # icons/mob/robots.dmi # icons/mob/species/tajaran/helmet.dmi # icons/obj/ammo.dmi # icons/obj/gun.dmi # icons/obj/mining.dmi # icons/obj/projectiles.dmi # icons/obj/rig_modules.dmi # icons/obj/surgery.dmi # icons/turf/walls.dmi # maps/southern_cross/southern_cross-1.dmm # maps/southern_cross/southern_cross-3.dmm # maps/southern_cross/southern_cross-6.dmm # maps/southern_cross/southern_cross-8.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1A.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1B.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1C.dmm # maps/submaps/surface_submaps/mountains/crashedcontainmentshuttle.dmm # maps/submaps/surface_submaps/mountains/deadspy.dmm # maps/submaps/surface_submaps/mountains/mountains_areas.dm # maps/submaps/surface_submaps/plains/Thiefc.dmm # maps/~map_system/maps.dm # vorestation.dme
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
|
||||
/datum/controller/process/nanoui/statProcess()
|
||||
..()
|
||||
stat(null, "[nanomanager.processing_uis.len] UIs")
|
||||
stat(null, "[GLOB.nanomanager.processing_uis.len] UIs")
|
||||
|
||||
/datum/controller/process/nanoui/doWork()
|
||||
for(last_object in nanomanager.processing_uis)
|
||||
for(last_object in GLOB.nanomanager.processing_uis)
|
||||
var/datum/nanoui/NUI = last_object
|
||||
if(istype(NUI) && !QDELETED(NUI))
|
||||
try
|
||||
@@ -16,4 +16,4 @@
|
||||
catchException(e, NUI)
|
||||
else
|
||||
catchBadType(NUI)
|
||||
nanomanager.processing_uis -= NUI
|
||||
GLOB.nanomanager.processing_uis -= NUI
|
||||
@@ -8,15 +8,22 @@
|
||||
//Computers are in /code/game/machinery/computer/supply.dm
|
||||
|
||||
/datum/supply_order
|
||||
var/ordernum
|
||||
var/datum/supply_packs/object = null
|
||||
var/orderedby = null
|
||||
var/comment = null
|
||||
var/ordernum // Unfabricatable index
|
||||
var/index // Fabricatable index
|
||||
var/datum/supply_pack/object = null
|
||||
var/cost // Cost of the supply pack (Fabricatable) (Changes not reflected when purchasing supply packs, this is cosmetic only)
|
||||
var/name // Name of the supply pack datum (Fabricatable)
|
||||
var/ordered_by = null // Who requested the order
|
||||
var/comment = null // What reason was given for the order
|
||||
var/approved_by = null // Who approved the order
|
||||
var/ordered_at // Date and time the order was requested at
|
||||
var/approved_at // Date and time the order was approved at
|
||||
var/status // [Requested, Accepted, Denied, Shipped]
|
||||
|
||||
/datum/exported_crate
|
||||
var/name
|
||||
var/value
|
||||
|
||||
var/list/contents
|
||||
|
||||
var/datum/controller/supply/supply_controller = new()
|
||||
|
||||
@@ -25,25 +32,29 @@ var/datum/controller/supply/supply_controller = new()
|
||||
var/points = 50
|
||||
var/points_per_process = 1.5
|
||||
var/points_per_slip = 2
|
||||
var/points_per_platinum = 5 // 5 points per sheet
|
||||
var/points_per_phoron = 5
|
||||
var/points_per_money = 0.02 // 1 point for $50
|
||||
//control
|
||||
var/ordernum
|
||||
var/list/shoppinglist = list()
|
||||
var/list/requestlist = list()
|
||||
var/list/supply_packs = list()
|
||||
var/list/exported_crates = list()
|
||||
var/list/shoppinglist = list() // Approved orders
|
||||
var/list/supply_pack = list() // All supply packs
|
||||
var/list/exported_crates = list() // Crates sent from the station
|
||||
var/list/order_history = list() // History of orders, showing edits made by users
|
||||
var/list/adm_order_history = list() // Complete history of all orders, for admin use
|
||||
var/list/adm_export_history = list() // Complete history of all crates sent back on the shuttle, for admin use
|
||||
//shuttle movement
|
||||
var/movetime = 1200
|
||||
var/datum/shuttle/ferry/supply/shuttle
|
||||
var/list/material_points_conversion = list( // Any materials not named in this list are worth 0 points
|
||||
"phoron" = 5,
|
||||
"platinum" = 5
|
||||
)
|
||||
|
||||
/datum/controller/supply/New()
|
||||
ordernum = rand(1,9000)
|
||||
|
||||
for(var/typepath in (typesof(/datum/supply_packs) - /datum/supply_packs))
|
||||
var/datum/supply_packs/P = new typepath()
|
||||
supply_packs[P.name] = P
|
||||
for(var/typepath in subtypesof(/datum/supply_pack))
|
||||
var/datum/supply_pack/P = new typepath()
|
||||
supply_pack[P.name] = P
|
||||
|
||||
/datum/controller/process/supply/setup()
|
||||
name = "supply controller"
|
||||
@@ -80,23 +91,17 @@ var/datum/controller/supply/supply_controller = new()
|
||||
|
||||
callHook("sell_shuttle", list(area_shuttle));
|
||||
|
||||
var/phoron_count = 0
|
||||
var/plat_count = 0
|
||||
var/money_count = 0
|
||||
|
||||
exported_crates = list()
|
||||
|
||||
for(var/atom/movable/MA in area_shuttle)
|
||||
if(MA.anchored)
|
||||
continue
|
||||
|
||||
var/datum/exported_crate/EC = new /datum/exported_crate()
|
||||
EC.name = "\proper[MA.name]"
|
||||
EC.value = 0
|
||||
EC.contents = list()
|
||||
|
||||
// Must be in a crate!
|
||||
if(istype(MA,/obj/structure/closet/crate))
|
||||
var/oldpoints = points
|
||||
var/oldphoron = phoron_count
|
||||
var/oldplatinum = plat_count
|
||||
var/oldmoney = money_count
|
||||
|
||||
var/obj/structure/closet/crate/CR = MA
|
||||
callHook("sell_crate", list(CR, area_shuttle))
|
||||
|
||||
@@ -104,44 +109,63 @@ var/datum/controller/supply/supply_controller = new()
|
||||
var/find_slip = 1
|
||||
|
||||
for(var/atom/A in CR)
|
||||
EC.contents[++EC.contents.len] = list(
|
||||
"object" = "\proper[A.name]",
|
||||
"value" = 0,
|
||||
"quantity" = 1
|
||||
)
|
||||
|
||||
// Sell manifests
|
||||
if(find_slip && istype(A,/obj/item/weapon/paper/manifest))
|
||||
var/obj/item/weapon/paper/manifest/slip = A
|
||||
if(!slip.is_copy && slip.stamped && slip.stamped.len) //yes, the clown stamp will work. clown is the highest authority on the station, it makes sense
|
||||
points += points_per_slip
|
||||
EC.contents[EC.contents.len]["value"] = points_per_slip
|
||||
find_slip = 0
|
||||
continue
|
||||
|
||||
// Sell phoron and platinum
|
||||
if(istype(A, /obj/item/stack))
|
||||
var/obj/item/stack/P = A
|
||||
switch(P.get_material_name())
|
||||
if("phoron")
|
||||
phoron_count += P.get_amount()
|
||||
if("platinum")
|
||||
plat_count += P.get_amount()
|
||||
if(material_points_conversion[P.get_material_name()])
|
||||
EC.contents[EC.contents.len]["value"] = P.get_amount() * material_points_conversion[P.get_material_name()]
|
||||
EC.contents[EC.contents.len]["quantity"] = P.get_amount()
|
||||
EC.value += EC.contents[EC.contents.len]["value"]
|
||||
|
||||
//Sell spacebucks
|
||||
if(istype(A, /obj/item/weapon/spacecash))
|
||||
var/obj/item/weapon/spacecash/cashmoney = A
|
||||
money_count += cashmoney.worth
|
||||
EC.contents[EC.contents.len]["value"] = cashmoney.worth * points_per_money
|
||||
EC.contents[EC.contents.len]["quantity"] = cashmoney.worth
|
||||
EC.value += EC.contents[EC.contents.len]["value"]
|
||||
|
||||
var/datum/exported_crate/EC = new /datum/exported_crate()
|
||||
EC.name = CR.name
|
||||
EC.value = points - oldpoints
|
||||
EC.value += (phoron_count - oldphoron) * points_per_phoron
|
||||
EC.value += (plat_count - oldplatinum) * points_per_platinum
|
||||
EC.value += (money_count - oldmoney) * points_per_money
|
||||
exported_crates += EC
|
||||
|
||||
|
||||
// Make a log of it, but it wasn't shipped properly, and so isn't worth anything
|
||||
else
|
||||
EC.contents = list(
|
||||
"error" = "Error: Product was improperly packaged. Payment rendered null under terms of agreement."
|
||||
)
|
||||
|
||||
exported_crates += EC
|
||||
points += EC.value
|
||||
|
||||
// Duplicate the receipt for the admin-side log
|
||||
var/datum/exported_crate/adm = new()
|
||||
adm.name = EC.name
|
||||
adm.value = EC.value
|
||||
adm.contents = deepCopyList(EC.contents)
|
||||
adm_export_history += adm
|
||||
|
||||
qdel(MA)
|
||||
|
||||
points += phoron_count * points_per_phoron
|
||||
points += plat_count * points_per_platinum
|
||||
points += money_count * points_per_money
|
||||
|
||||
//Buying
|
||||
/datum/controller/supply/proc/buy()
|
||||
var/list/shoppinglist = list()
|
||||
for(var/datum/supply_order/SO in order_history)
|
||||
if(SO.status == SUP_ORDER_APPROVED)
|
||||
shoppinglist += SO
|
||||
|
||||
if(!shoppinglist.len)
|
||||
return
|
||||
|
||||
@@ -165,17 +189,16 @@ var/datum/controller/supply/supply_controller = new()
|
||||
continue
|
||||
clear_turfs += T
|
||||
|
||||
for(var/S in shoppinglist)
|
||||
for(var/datum/supply_order/SO in shoppinglist)
|
||||
if(!clear_turfs.len)
|
||||
break
|
||||
|
||||
var/i = rand(1,clear_turfs.len)
|
||||
var/turf/pickedloc = clear_turfs[i]
|
||||
clear_turfs.Cut(i,i+1)
|
||||
shoppinglist -= S
|
||||
|
||||
var/datum/supply_order/SO = S
|
||||
var/datum/supply_packs/SP = SO.object
|
||||
SO.status = SUP_ORDER_SHIPPED
|
||||
var/datum/supply_pack/SP = SO.object
|
||||
|
||||
var/obj/A = new SP.containertype(pickedloc)
|
||||
A.name = "[SP.containername] [SO.comment ? "([SO.comment])":"" ]"
|
||||
@@ -202,8 +225,8 @@ var/datum/controller/supply/supply_controller = new()
|
||||
log_debug("<span class='danger'>Supply pack with invalid access restriction [SP.access] encountered!</span>")
|
||||
|
||||
var/list/contains
|
||||
if(istype(SP,/datum/supply_packs/randomised))
|
||||
var/datum/supply_packs/randomised/SPR = SP
|
||||
if(istype(SP,/datum/supply_pack/randomised))
|
||||
var/datum/supply_pack/randomised/SPR = SP
|
||||
contains = list()
|
||||
if(SPR.contains.len)
|
||||
for(var/j=1,j<=SPR.num_contained,j++)
|
||||
@@ -227,3 +250,141 @@ var/datum/controller/supply/supply_controller = new()
|
||||
slip.info += "CHECK CONTENTS AND STAMP BELOW THE LINE TO CONFIRM RECEIPT OF GOODS<hr>"
|
||||
|
||||
return
|
||||
|
||||
// Will attempt to purchase the specified order, returning TRUE on success, FALSE on failure
|
||||
/datum/controller/supply/proc/approve_order(var/datum/supply_order/O, var/mob/user)
|
||||
// Not enough points to purchase the crate
|
||||
if(supply_controller.points <= O.object.cost)
|
||||
return FALSE
|
||||
|
||||
// Based on the current model, there shouldn't be any entries in order_history, requestlist, or shoppinglist, that aren't matched in adm_order_history
|
||||
var/datum/supply_order/adm_order
|
||||
for(var/datum/supply_order/temp in adm_order_history)
|
||||
if(temp.ordernum == O.ordernum)
|
||||
adm_order = temp
|
||||
break
|
||||
|
||||
var/idname = "*None Provided*"
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
idname = H.get_authentification_name()
|
||||
else if(issilicon(user))
|
||||
idname = user.real_name
|
||||
|
||||
// Update order status
|
||||
O.status = SUP_ORDER_APPROVED
|
||||
O.approved_by = idname
|
||||
O.approved_at = stationdate2text() + " - " + stationtime2text()
|
||||
// Update admin-side mirror
|
||||
adm_order.status = SUP_ORDER_APPROVED
|
||||
adm_order.approved_by = idname
|
||||
adm_order.approved_at = stationdate2text() + " - " + stationtime2text()
|
||||
|
||||
// Deduct cost
|
||||
supply_controller.points -= O.object.cost
|
||||
return TRUE
|
||||
|
||||
// Will deny the specified order. Only useful if the order is currently requested, but available at any status
|
||||
/datum/controller/supply/proc/deny_order(var/datum/supply_order/O, var/mob/user)
|
||||
// Based on the current model, there shouldn't be any entries in order_history, requestlist, or shoppinglist, that aren't matched in adm_order_history
|
||||
var/datum/supply_order/adm_order
|
||||
for(var/datum/supply_order/temp in adm_order_history)
|
||||
if(temp.ordernum == O.ordernum)
|
||||
adm_order = temp
|
||||
break
|
||||
|
||||
var/idname = "*None Provided*"
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
idname = H.get_authentification_name()
|
||||
else if(issilicon(user))
|
||||
idname = user.real_name
|
||||
|
||||
// Update order status
|
||||
O.status = SUP_ORDER_DENIED
|
||||
O.approved_by = idname
|
||||
O.approved_at = stationdate2text() + " - " + stationtime2text()
|
||||
// Update admin-side mirror
|
||||
adm_order.status = SUP_ORDER_DENIED
|
||||
adm_order.approved_by = idname
|
||||
adm_order.approved_at = stationdate2text() + " - " + stationtime2text()
|
||||
return
|
||||
|
||||
// Will deny all requested orders
|
||||
/datum/controller/supply/proc/deny_all_pending(var/mob/user)
|
||||
for(var/datum/supply_order/O in order_history)
|
||||
if(O.status == SUP_ORDER_REQUESTED)
|
||||
deny_order(O, user)
|
||||
|
||||
// Will delete the specified order from the user-side list
|
||||
/datum/controller/supply/proc/delete_order(var/datum/supply_order/O, var/mob/user)
|
||||
// Making sure they know what they're doing
|
||||
if(alert(user, "Are you sure you want to delete this record? If it has been approved, cargo points will NOT be refunded!", "Delete Record","No","Yes") == "Yes")
|
||||
if(alert(user, "Are you really sure? There is no way to recover the order once deleted.", "Delete Record", "No", "Yes") == "Yes")
|
||||
log_admin("[key_name(user)] has deleted supply order \ref[O] [O] from the user-side order history.")
|
||||
supply_controller.order_history -= O
|
||||
return
|
||||
|
||||
// Will generate a new, requested order, for the given supply pack type
|
||||
/datum/controller/supply/proc/create_order(var/datum/supply_pack/S, var/mob/user, var/reason)
|
||||
var/datum/supply_order/new_order = new()
|
||||
var/datum/supply_order/adm_order = new() // Admin-recorded order must be a separate copy in memory, or user-made edits will corrupt it
|
||||
|
||||
var/idname = "*None Provided*"
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
idname = H.get_authentification_name()
|
||||
else if(issilicon(user))
|
||||
idname = user.real_name
|
||||
|
||||
new_order.ordernum = ++ordernum // Ordernum is used to track the order between the playerside list of orders and the adminside list
|
||||
new_order.index = new_order.ordernum // Index can be fabricated, or falsified. Ordernum is a permanent marker used to track the order
|
||||
new_order.object = S
|
||||
new_order.name = S.name
|
||||
new_order.cost = S.cost
|
||||
new_order.ordered_by = idname
|
||||
new_order.comment = reason
|
||||
new_order.ordered_at = stationdate2text() + " - " + stationtime2text()
|
||||
new_order.status = SUP_ORDER_REQUESTED
|
||||
|
||||
adm_order.ordernum = new_order.ordernum
|
||||
adm_order.index = new_order.index
|
||||
adm_order.object = new_order.object
|
||||
adm_order.name = new_order.name
|
||||
adm_order.cost = new_order.cost
|
||||
adm_order.ordered_by = new_order.ordered_by
|
||||
adm_order.comment = new_order.comment
|
||||
adm_order.ordered_at = new_order.ordered_at
|
||||
adm_order.status = new_order.status
|
||||
|
||||
order_history += new_order
|
||||
adm_order_history += adm_order
|
||||
|
||||
// Will delete the specified export receipt from the user-side list
|
||||
/datum/controller/supply/proc/delete_export(var/datum/exported_crate/E, var/mob/user)
|
||||
// Making sure they know what they're doing
|
||||
if(alert(user, "Are you sure you want to delete this record?", "Delete Record","No","Yes") == "Yes")
|
||||
if(alert(user, "Are you really sure? There is no way to recover the receipt once deleted.", "Delete Record", "No", "Yes") == "Yes")
|
||||
log_admin("[key_name(user)] has deleted export receipt \ref[E] [E] from the user-side export history.")
|
||||
supply_controller.exported_crates -= E
|
||||
return
|
||||
|
||||
// Will add an item entry to the specified export receipt on the user-side list
|
||||
/datum/controller/supply/proc/add_export_item(var/datum/exported_crate/E, var/mob/user)
|
||||
var/new_name = input(user, "Name", "Please enter the name of the item.") as null|text
|
||||
if(!new_name)
|
||||
return
|
||||
|
||||
var/new_quantity = input(user, "Name", "Please enter the quantity of the item.") as null|num
|
||||
if(!new_quantity)
|
||||
return
|
||||
|
||||
var/new_value = input(user, "Name", "Please enter the value of the item.") as null|num
|
||||
if(!new_value)
|
||||
return
|
||||
|
||||
E.contents[++E.contents.len] = list(
|
||||
"object" = new_name,
|
||||
"quantity" = new_quantity,
|
||||
"value" = new_value
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user