mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Replaced "area" shuttles with "landmark" shuttles.
Largely ported from the work done at Baystation in https://github.com/Baystation12/Baystation12/pull/17460 and later commits. - Shuttles no longer require a separate area for each location they jump to. Instead destinations are indicated by landmark objects, which are not necessarily exclusive to that shuttle. This means that more than one shuttle could use the same docking port (not at the same time of course). - Enhanced shuttle control computers to use nanoui if they didn't. - Organizes shuttle datum code a bit better so there is less re-inventing the wheel in subtypes. - Allows the possibility of shuttles (or destinations) that start on late-loaded maps. - Deprecate the "extra" shuttle areas that are no longer needed and update shuttle areas in unit tests This all required a bit of infrastructure improvements. - ChangeArea proc, for changing the area of a turf. - Fixed lighting overlays actually being able to be destroyed. - Added a few utility macros and procs. - Added "turf translation" procs which are like move_contents_to but more flexible.
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
//Config stuff
|
||||
#define SUPPLY_DOCKZ 2 //Z-level of the Dock.
|
||||
#define SUPPLY_STATIONZ 1 //Z-level of the Station.
|
||||
#define SUPPLY_STATION_AREATYPE "/area/supply/station" //Type of the supply shuttle area for station
|
||||
#define SUPPLY_DOCK_AREATYPE "/area/supply/dock" //Type of the supply shuttle area for dock
|
||||
|
||||
// TODO - Refactor to use the Supply Subsystem (SSsupply)
|
||||
|
||||
//Supply packs are in /code/datums/supplypacks
|
||||
//Computers are in /code/game/machinery/computer/supply.dm
|
||||
@@ -43,7 +40,7 @@ var/datum/controller/supply/supply_controller = new()
|
||||
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/datum/shuttle/autodock/ferry/supply/shuttle
|
||||
var/list/material_points_conversion = list( // Any materials not named in this list are worth 0 points
|
||||
"phoron" = 5,
|
||||
"platinum" = 5
|
||||
@@ -90,83 +87,98 @@ var/datum/controller/supply/supply_controller = new()
|
||||
|
||||
//Selling
|
||||
/datum/controller/supply/proc/sell()
|
||||
var/area/area_shuttle = shuttle.get_location_area()
|
||||
if(!area_shuttle)
|
||||
return
|
||||
// Loop over each area in the supply shuttle
|
||||
for(var/area/subarea in shuttle.shuttle_area)
|
||||
callHook("sell_shuttle", list(subarea));
|
||||
for(var/atom/movable/MA in subarea)
|
||||
if(MA.anchored)
|
||||
continue
|
||||
|
||||
callHook("sell_shuttle", list(area_shuttle));
|
||||
var/datum/exported_crate/EC = new /datum/exported_crate()
|
||||
EC.name = "\proper[MA.name]"
|
||||
EC.value = 0
|
||||
EC.contents = list()
|
||||
var/base_value = 0
|
||||
|
||||
for(var/atom/movable/MA in area_shuttle)
|
||||
if(MA.anchored)
|
||||
continue
|
||||
// Must be in a crate!
|
||||
if(istype(MA,/obj/structure/closet/crate))
|
||||
var/obj/structure/closet/crate/CR = MA
|
||||
callHook("sell_crate", list(CR, subarea))
|
||||
|
||||
var/datum/exported_crate/EC = new /datum/exported_crate()
|
||||
EC.name = "\proper[MA.name]"
|
||||
EC.value = 0
|
||||
EC.contents = list()
|
||||
var/base_value = 0
|
||||
points += CR.points_per_crate
|
||||
if(CR.points_per_crate)
|
||||
base_value = CR.points_per_crate
|
||||
var/find_slip = 1
|
||||
|
||||
// Must be in a crate!
|
||||
if(istype(MA,/obj/structure/closet/crate))
|
||||
var/obj/structure/closet/crate/CR = MA
|
||||
callHook("sell_crate", list(CR, area_shuttle))
|
||||
for(var/atom/A in CR)
|
||||
EC.contents[++EC.contents.len] = list(
|
||||
"object" = "\proper[A.name]",
|
||||
"value" = 0,
|
||||
"quantity" = 1
|
||||
)
|
||||
|
||||
points += CR.points_per_crate
|
||||
if(CR.points_per_crate)
|
||||
base_value = CR.points_per_crate
|
||||
var/find_slip = 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
|
||||
|
||||
for(var/atom/A in CR)
|
||||
EC.contents[++EC.contents.len] = list(
|
||||
"object" = "\proper[A.name]",
|
||||
"value" = 0,
|
||||
"quantity" = 1
|
||||
// Sell phoron and platinum
|
||||
if(istype(A, /obj/item/stack))
|
||||
var/obj/item/stack/P = A
|
||||
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
|
||||
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"]
|
||||
|
||||
|
||||
|
||||
// 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."
|
||||
)
|
||||
|
||||
// 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
|
||||
exported_crates += EC
|
||||
points += EC.value
|
||||
EC.value += base_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)
|
||||
|
||||
/datum/controller/supply/proc/get_clear_turfs()
|
||||
var/list/clear_turfs = list()
|
||||
|
||||
for(var/area/subarea in shuttle.shuttle_area)
|
||||
for(var/turf/T in subarea)
|
||||
if(T.density)
|
||||
continue
|
||||
var/occupied = 0
|
||||
for(var/atom/A in T.contents)
|
||||
if(!A.simulated)
|
||||
continue
|
||||
occupied = 1
|
||||
break
|
||||
if(!occupied)
|
||||
clear_turfs += T
|
||||
|
||||
// Sell phoron and platinum
|
||||
if(istype(A, /obj/item/stack))
|
||||
var/obj/item/stack/P = A
|
||||
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
|
||||
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"]
|
||||
|
||||
|
||||
|
||||
// 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
|
||||
EC.value += base_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)
|
||||
return clear_turfs
|
||||
|
||||
//Buying
|
||||
/datum/controller/supply/proc/buy()
|
||||
@@ -177,26 +189,9 @@ var/datum/controller/supply/supply_controller = new()
|
||||
|
||||
if(!shoppinglist.len)
|
||||
return
|
||||
|
||||
var/orderedamount = shoppinglist.len
|
||||
|
||||
var/area/area_shuttle = shuttle.get_location_area()
|
||||
if(!area_shuttle)
|
||||
return
|
||||
|
||||
var/list/clear_turfs = list()
|
||||
|
||||
for(var/turf/T in area_shuttle)
|
||||
if(T.density)
|
||||
continue
|
||||
var/contcount
|
||||
for(var/atom/A in T.contents)
|
||||
if(!A.simulated)
|
||||
continue
|
||||
contcount++
|
||||
if(contcount)
|
||||
continue
|
||||
clear_turfs += T
|
||||
var/list/clear_turfs = get_clear_turfs()
|
||||
|
||||
for(var/datum/supply_order/SO in shoppinglist)
|
||||
if(!clear_turfs.len)
|
||||
|
||||
Reference in New Issue
Block a user