Changes the supply drop types into datums. Simplifies adding additional supply packs.

This commit is contained in:
PsiOmegaDelta
2015-08-13 12:11:18 +02:00
parent ed7ded4d13
commit 985acc9f70
5 changed files with 205 additions and 118 deletions

View File

@@ -1503,6 +1503,7 @@
#include "code\modules\random_map\automata\automata.dm" #include "code\modules\random_map\automata\automata.dm"
#include "code\modules\random_map\automata\caves.dm" #include "code\modules\random_map\automata\caves.dm"
#include "code\modules\random_map\building\building.dm" #include "code\modules\random_map\building\building.dm"
#include "code\modules\random_map\drop\drop_types.dm"
#include "code\modules\random_map\drop\droppod.dm" #include "code\modules\random_map\drop\droppod.dm"
#include "code\modules\random_map\drop\droppod_doors.dm" #include "code\modules\random_map\drop\droppod_doors.dm"
#include "code\modules\random_map\drop\supply.dm" #include "code\modules\random_map\drop\supply.dm"

View File

@@ -38,7 +38,7 @@
/obj/machinery/power/supply_beacon/New() /obj/machinery/power/supply_beacon/New()
..() ..()
if(!drop_type) drop_type = pick(supply_drop_random_loot_types) if(!drop_type) drop_type = pick(supply_drop_random_loot_types())
/obj/machinery/power/supply_beacon/supermatter /obj/machinery/power/supply_beacon/supermatter
name = "supermatter supply beacon" name = "supermatter supply beacon"

View File

@@ -0,0 +1,195 @@
var/global/list/datum/supply_drop_loot/supply_drop
/proc/supply_drop_random_loot_types()
if(!supply_drop)
supply_drop = init_subtypes(/datum/supply_drop_loot)
supply_drop = dd_sortedObjectList(supply_drop)
return supply_drop
/datum/supply_drop_loot
var/name = ""
var/container = null
var/list/contents = null
/datum/supply_drop_loot/proc/contents()
return contents
/datum/supply_drop_loot/proc/drop(turf/T)
var/C = container ? new container(T) : T
for(var/content in contents())
new content(C)
/datum/supply_drop_loot/dd_SortValue()
return name
/datum/supply_drop_loot/supermatter
name = "Supermatter"
/datum/supply_drop_loot/supermatter/New()
..()
contents = list(/obj/machinery/power/supermatter)
/datum/supply_drop_loot/lasers
name = "Lasers"
container = /obj/structure/largecrate
/datum/supply_drop_loot/lasers/New()
..()
contents = list(
/obj/item/weapon/gun/energy/laser,
/obj/item/weapon/gun/energy/laser,
/obj/item/weapon/gun/energy/sniperrifle,
/obj/item/weapon/gun/energy/ionrifle)
/datum/supply_drop_loot/ballistics
name = "Ballistics"
container = /obj/structure/largecrate
/datum/supply_drop_loot/ballistics/New()
..()
contents = list(
/obj/item/weapon/gun/projectile/sec,
/obj/item/weapon/gun/projectile/shotgun/doublebarrel,
/obj/item/weapon/gun/projectile/shotgun/pump/combat,
/obj/item/weapon/gun/projectile/automatic/wt550,
/obj/item/weapon/gun/projectile/automatic/z8)
/datum/supply_drop_loot/ballistics
name = "Ballistics"
container = /obj/structure/largecrate
/datum/supply_drop_loot/ballistics/New()
..()
contents = list(
/obj/item/weapon/gun/projectile/sec,
/obj/item/weapon/gun/projectile/shotgun/doublebarrel,
/obj/item/weapon/gun/projectile/shotgun/pump/combat,
/obj/item/weapon/gun/projectile/automatic/wt550,
/obj/item/weapon/gun/projectile/automatic/z8)
/datum/supply_drop_loot/seeds
name = "Seeds"
container = /obj/structure/closet/crate
/datum/supply_drop_loot/seeds/New()
..()
contents = list(
/obj/item/seeds/chiliseed,
/obj/item/seeds/berryseed,
/obj/item/seeds/cornseed,
/obj/item/seeds/eggplantseed,
/obj/item/seeds/tomatoseed,
/obj/item/seeds/appleseed,
/obj/item/seeds/soyaseed,
/obj/item/seeds/wheatseed,
/obj/item/seeds/carrotseed,
/obj/item/seeds/lemonseed,
/obj/item/seeds/orangeseed,
/obj/item/seeds/grassseed,
/obj/item/seeds/sunflowerseed,
/obj/item/seeds/chantermycelium,
/obj/item/seeds/potatoseed,
/obj/item/seeds/sugarcaneseed)
/datum/supply_drop_loot/food
name = "Food"
container = /obj/structure/largecrate
/datum/supply_drop_loot/food/New()
..()
contents = list(
/obj/item/weapon/reagent_containers/food/condiment/flour,
/obj/item/weapon/reagent_containers/food/condiment/flour,
/obj/item/weapon/reagent_containers/food/condiment/flour,
/obj/item/weapon/reagent_containers/food/drinks/milk,
/obj/item/weapon/reagent_containers/food/drinks/milk,
/obj/item/weapon/storage/fancy/egg_box,
/obj/item/weapon/reagent_containers/food/snacks/tofu,
/obj/item/weapon/reagent_containers/food/snacks/tofu,
/obj/item/weapon/reagent_containers/food/snacks/meat,
/obj/item/weapon/reagent_containers/food/snacks/meat)
/datum/supply_drop_loot/armour
name = "Armour"
container = /obj/structure/largecrate
/datum/supply_drop_loot/armour/New()
..()
contents = list(
/obj/item/clothing/head/helmet/riot,
/obj/item/clothing/suit/armor/riot,
/obj/item/clothing/head/helmet/riot,
/obj/item/clothing/suit/armor/riot,
/obj/item/clothing/head/helmet/riot,
/obj/item/clothing/suit/armor/riot,
/obj/item/clothing/suit/storage/vest,
/obj/item/clothing/suit/storage/vest,
/obj/item/clothing/suit/storage/vest/heavy,
/obj/item/clothing/suit/storage/vest/heavy,
/obj/item/clothing/suit/armor/laserproof,
/obj/item/clothing/suit/armor/bulletproof)
/datum/supply_drop_loot/materials
name = "Materials"
container = /obj/structure/largecrate
/datum/supply_drop_loot/materials/New()
..()
contents = list(
/obj/item/stack/material/steel,
/obj/item/stack/material/steel,
/obj/item/stack/material/steel,
/obj/item/stack/material/glass,
/obj/item/stack/material/glass,
/obj/item/stack/material/wood,
/obj/item/stack/material/plastic,
/obj/item/stack/material/glass/reinforced,
/obj/item/stack/material/plasteel)
/datum/supply_drop_loot/medical
name = "Medical"
container = /obj/structure/closet/crate/medical
/datum/supply_drop_loot/medical/New()
..()
contents = list(
/obj/item/weapon/storage/firstaid/regular,
/obj/item/weapon/storage/firstaid/fire,
/obj/item/weapon/storage/firstaid/toxin,
/obj/item/weapon/storage/firstaid/o2,
/obj/item/weapon/storage/firstaid/adv,
/obj/item/weapon/reagent_containers/glass/bottle/antitoxin,
/obj/item/weapon/reagent_containers/glass/bottle/inaprovaline,
/obj/item/weapon/reagent_containers/glass/bottle/stoxin,
/obj/item/weapon/storage/box/syringes,
/obj/item/weapon/storage/box/autoinjectors)
/datum/supply_drop_loot/power
name = "Power"
container = /obj/structure/largecrate
/datum/supply_drop_loot/power/New()
..()
contents = list(
/obj/item/stack/material/steel,
/obj/item/stack/material/steel,
/obj/item/stack/material/steel,
/obj/item/stack/material/glass,
/obj/item/stack/material/glass,
/obj/item/stack/material/wood,
/obj/item/stack/material/plastic,
/obj/item/stack/material/glass/reinforced,
/obj/item/stack/material/plasteel)
/datum/supply_drop_loot/hydroponics
name = "Hydroponics"
container = /obj/structure/largecrate
/datum/supply_drop_loot/hydroponics/New()
..()
contents = list(
/obj/machinery/portable_atmospherics/hydroponics,
/obj/machinery/portable_atmospherics/hydroponics,
/obj/machinery/portable_atmospherics/hydroponics)
/datum/supply_drop_loot/power
name = "Power"
container = /obj/structure/largecrate
/datum/supply_drop_loot/power/New()
..()
contents = list(
/obj/machinery/power/port_gen/pacman,
/obj/machinery/power/port_gen/pacman/super,
/obj/machinery/power/port_gen/pacman/mrs)
/datum/supply_drop_loot/power/contents()
return list(pick(contents))

View File

@@ -4,19 +4,6 @@
#define SD_EMPTY_TILE 3 #define SD_EMPTY_TILE 3
#define SD_SUPPLY_TILE 7 #define SD_SUPPLY_TILE 7
var/global/list/supply_drop_random_loot_types = list(
"guns",
"seeds",
"materials",
"food",
"armour",
"medical",
"power",
"hydroponics",
"lasers",
"ballistics"
)
/datum/random_map/droppod /datum/random_map/droppod
descriptor = "drop pod" descriptor = "drop pod"
initial_wall_cell = 0 initial_wall_cell = 0

View File

@@ -11,7 +11,7 @@
// supplied_drop_types is a list of types to spawn in the pod. // supplied_drop_types is a list of types to spawn in the pod.
/datum/random_map/droppod/supply/get_spawned_drop(var/turf/T) /datum/random_map/droppod/supply/get_spawned_drop(var/turf/T)
if(!drop_type) drop_type = pick(supply_drop_random_loot_types) if(!drop_type) drop_type = pick(supply_drop_random_loot_types())
if(drop_type == "custom") if(drop_type == "custom")
if(supplied_drop_types.len) if(supplied_drop_types.len)
@@ -23,110 +23,14 @@
C.contents |= A C.contents |= A
return return
else else
drop_type = pick(supply_drop_random_loot_types) drop_type = pick(supply_drop_random_loot_types())
switch(drop_type) if(istype(drop_type, /datum/supply_drop_loot))
var/datum/supply_drop_loot/SDL = drop_type
SDL.drop(T)
else
error("Unhandled drop type: [drop_type]")
if("supermatter")
new /obj/machinery/power/supermatter(T)
if("lasers")
var/obj/structure/largecrate/C = new(T)
new /obj/item/weapon/gun/energy/laser(C)
new /obj/item/weapon/gun/energy/laser(C)
new /obj/item/weapon/gun/energy/sniperrifle(C)
new /obj/item/weapon/gun/energy/ionrifle(C)
if("ballistics")
var/obj/structure/largecrate/C = new(T)
new /obj/item/weapon/gun/projectile/sec(C)
new /obj/item/weapon/gun/projectile/shotgun/doublebarrel(C)
new /obj/item/weapon/gun/projectile/shotgun/pump/combat(C)
new /obj/item/weapon/gun/projectile/automatic/wt550(C)
new /obj/item/weapon/gun/projectile/automatic/z8(C)
if("seeds")
var/obj/structure/closet/crate/C = new(T)
new /obj/item/seeds/chiliseed(C)
new /obj/item/seeds/berryseed(C)
new /obj/item/seeds/cornseed(C)
new /obj/item/seeds/eggplantseed(C)
new /obj/item/seeds/tomatoseed(C)
new /obj/item/seeds/appleseed(C)
new /obj/item/seeds/soyaseed(C)
new /obj/item/seeds/wheatseed(C)
new /obj/item/seeds/carrotseed(C)
new /obj/item/seeds/lemonseed(C)
new /obj/item/seeds/orangeseed(C)
new /obj/item/seeds/grassseed(C)
new /obj/item/seeds/sunflowerseed(C)
new /obj/item/seeds/chantermycelium(C)
new /obj/item/seeds/potatoseed(C)
new /obj/item/seeds/sugarcaneseed(C)
if("food")
var/obj/structure/largecrate/C = new(T)
new /obj/item/weapon/reagent_containers/food/condiment/flour(C)
new /obj/item/weapon/reagent_containers/food/condiment/flour(C)
new /obj/item/weapon/reagent_containers/food/condiment/flour(C)
new /obj/item/weapon/reagent_containers/food/drinks/milk(C)
new /obj/item/weapon/reagent_containers/food/drinks/milk(C)
new /obj/item/weapon/storage/fancy/egg_box(C)
new /obj/item/weapon/reagent_containers/food/snacks/tofu(C)
new /obj/item/weapon/reagent_containers/food/snacks/tofu(C)
new /obj/item/weapon/reagent_containers/food/snacks/meat(C)
new /obj/item/weapon/reagent_containers/food/snacks/meat(C)
if("armour")
var/obj/structure/largecrate/C = new(T)
new /obj/item/clothing/head/helmet/riot(C)
new /obj/item/clothing/suit/armor/riot(C)
new /obj/item/clothing/head/helmet/riot(C)
new /obj/item/clothing/suit/armor/riot(C)
new /obj/item/clothing/head/helmet/riot(C)
new /obj/item/clothing/suit/armor/riot(C)
new /obj/item/clothing/suit/storage/vest(C)
new /obj/item/clothing/suit/storage/vest(C)
new /obj/item/clothing/suit/storage/vest/heavy(C)
new /obj/item/clothing/suit/storage/vest/heavy(C)
new /obj/item/clothing/suit/armor/laserproof(C)
new /obj/item/clothing/suit/armor/bulletproof(C)
if("materials")
var/obj/structure/largecrate/C = new(T)
new /obj/item/stack/material/steel(C)
new /obj/item/stack/material/steel(C)
new /obj/item/stack/material/steel(C)
new /obj/item/stack/material/glass(C)
new /obj/item/stack/material/glass(C)
new /obj/item/stack/material/wood(C)
new /obj/item/stack/material/plastic(C)
new /obj/item/stack/material/glass/reinforced(C)
new /obj/item/stack/material/plasteel(C)
if("medical")
var/obj/structure/closet/crate/medical/M = new(T)
new /obj/item/weapon/storage/firstaid/regular(M)
new /obj/item/weapon/storage/firstaid/fire(M)
new /obj/item/weapon/storage/firstaid/toxin(M)
new /obj/item/weapon/storage/firstaid/o2(M)
new /obj/item/weapon/storage/firstaid/adv(M)
new /obj/item/weapon/reagent_containers/glass/bottle/antitoxin(M)
new /obj/item/weapon/reagent_containers/glass/bottle/inaprovaline(M)
new /obj/item/weapon/reagent_containers/glass/bottle/stoxin(M)
new /obj/item/weapon/storage/box/syringes(M)
new /obj/item/weapon/storage/box/autoinjectors(M)
if("power")
var/obj/structure/largecrate/C = new(T)
var/gen_type = pick(list(/obj/machinery/power/port_gen/pacman,/obj/machinery/power/port_gen/pacman/super,/obj/machinery/power/port_gen/pacman/mrs))
new gen_type(C)
if("hydroponics")
var/obj/structure/largecrate/C = new(T)
new /obj/machinery/portable_atmospherics/hydroponics(C)
new /obj/machinery/portable_atmospherics/hydroponics(C)
new /obj/machinery/portable_atmospherics/hydroponics(C)
/datum/admins/proc/call_supply_drop() /datum/admins/proc/call_supply_drop()
set category = "Fun" set category = "Fun"
@@ -180,7 +84,7 @@
else else
choice = alert("Do you wish to specify a loot type?",,"No","Yes") choice = alert("Do you wish to specify a loot type?",,"No","Yes")
if(choice == "Yes") if(choice == "Yes")
chosen_loot_type = input("Select a loot type.", "Loot Selection", null) as null|anything in supply_drop_random_loot_types chosen_loot_type = input("Select a loot type.", "Loot Selection", null) as null|anything in supply_drop_random_loot_types()
choice = alert("Are you SURE you wish to deploy this supply drop? It will cause a sizable explosion and gib anyone underneath it.",,"No","Yes") choice = alert("Are you SURE you wish to deploy this supply drop? It will cause a sizable explosion and gib anyone underneath it.",,"No","Yes")
if(choice == "No") if(choice == "No")