Skip to content

Commit

Permalink
Merge pull request yogstation13#1280 from Super3222/fixCargo
Browse files Browse the repository at this point in the history
Ports /tg/'s shuttle loan systems and fixes yogstation13#1277
  • Loading branch information
oisin100 authored Jun 15, 2016
2 parents 9cb4031 + 8a36b8f commit f89c101
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 31 deletions.
22 changes: 7 additions & 15 deletions code/datums/supplypacks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
var/name = null
var/list/contains = list()
var/manifest = ""
var/amount = null
var/cost = null
var/containertype = /obj/structure/closet/crate
var/crate_name = null
Expand Down Expand Up @@ -1006,43 +1005,37 @@

/datum/supply_packs/materials/metal50
name = "50 Metal Sheets"
contains = list(/obj/item/stack/sheet/metal)
amount = 50
contains = list(/obj/item/stack/sheet/metal/fifty)
cost = 1000
crate_name = "metal sheets crate"

/datum/supply_packs/materials/plasteel20
name = "20 Plasteel Sheets"
contains = list(/obj/item/stack/sheet/plasteel)
amount = 20
contains = list(/obj/item/stack/sheet/plasteel/twenty)
cost = 3000
crate_name = "plasteel sheets crate"

/datum/supply_packs/materials/plasteel50
name = "50 Plasteel Sheets"
contains = list(/obj/item/stack/sheet/plasteel)
amount = 50
contains = list(/obj/item/stack/sheet/plasteel/fifty)
cost = 5000
crate_name = "plasteel sheets crate"

/datum/supply_packs/materials/glass50
name = "50 Glass Sheets"
contains = list(/obj/item/stack/sheet/glass)
amount = 50
contains = list(/obj/item/stack/sheet/glass/fifty)
cost = 1000
crate_name = "glass sheets crate"

/datum/supply_packs/materials/cardboard50
name = "50 Cardboard Sheets"
contains = list(/obj/item/stack/sheet/cardboard)
amount = 50
contains = list(/obj/item/stack/sheet/cardboard/fifty)
cost = 1000
crate_name = "cardboard sheets crate"

/datum/supply_packs/materials/sandstone30
name = "30 Sandstone Blocks"
contains = list(/obj/item/stack/sheet/mineral/sandstone)
amount = 30
contains = list(/obj/item/stack/sheet/mineral/sandstone/fifty)
cost = 1000
crate_name = "sandstone blocks crate"

Expand Down Expand Up @@ -1201,8 +1194,7 @@

/datum/supply_packs/misc/noslipfloor
name = "High-traction Floor Tiles"
contains = list(/obj/item/stack/tile/noslip)
amount = 20
contains = list(/obj/item/stack/tile/noslip/fifty)
cost = 2000
crate_name = "high-traction floor tiles"

Expand Down
3 changes: 3 additions & 0 deletions code/game/objects/items/stacks/sheets/glass.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
is_cyborg = 1
cost = 500

/obj/item/stack/sheet/glass/fifty
amount = 50

/obj/item/stack/sheet/glass/attack_self(mob/user)
construct_window(user)

Expand Down
3 changes: 3 additions & 0 deletions code/game/objects/items/stacks/sheets/mineral.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ var/global/list/datum/stack_recipe/sandstone_recipes = list ( \
new/datum/stack_recipe("sandstone floor", ???),\ */
)

/obj/item/stack/sheet/mineral/sandstone/fifty
amount = 50

/obj/item/stack/sheet/mineral/sandstone/New(var/loc, var/amount=null)
recipes = sandstone_recipes
pixel_x = rand(0,4)-4
Expand Down
15 changes: 14 additions & 1 deletion code/game/objects/items/stacks/sheets/sheet_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ var/global/list/datum/stack_recipe/metal_recipes = list ( \
return ..()


/obj/item/stack/sheet/metal/fifty
amount = 50


/*
* Plasteel
*/
Expand All @@ -85,6 +89,12 @@ var/global/list/datum/stack_recipe/plasteel_recipes = list ( \
recipes = plasteel_recipes
return ..()

/obj/item/stack/sheet/plasteel/twenty
amount = 20

/obj/item/stack/sheet/plasteel/fifty
amount = 50

/*
* Wood
*/
Expand Down Expand Up @@ -151,4 +161,7 @@ var/global/list/datum/stack_recipe/cardboard_recipes = list ( \

/obj/item/stack/sheet/cardboard/New(var/loc, var/amount=null)
recipes = cardboard_recipes
return ..()
return ..()

/obj/item/stack/sheet/cardboard/fifty
amount = 50
2 changes: 2 additions & 0 deletions code/game/objects/items/stacks/tiles/tile_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@
turf_type = /turf/simulated/floor/noslip
origin_tech = "material=3"

/obj/item/stack/tile/noslip/fifty
amount = 50

//Plasteel (normal)
/obj/item/stack/tile/plasteel
Expand Down
24 changes: 9 additions & 15 deletions code/modules/events/shuttle_loan.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
var/list/shuttle_spawns = list()
switch(dispatch_type)
if(HIJACK_SYNDIE)
add_crates(list(/datum/supply_packs/emergency/specialops), empty_shuttle_turfs)
var/datum/supply_packs/pack = SSshuttle.supply_packs[/datum/supply_packs/emergency/specialops]
pack.generate(pick_n_take(empty_shuttle_turfs))
shuttle_spawns.Add(/mob/living/simple_animal/hostile/syndicate)
shuttle_spawns.Add(/mob/living/simple_animal/hostile/syndicate)
if(prob(75))
Expand All @@ -99,7 +100,8 @@
shuttle_spawns.Add(/mob/living/simple_animal/hostile/syndicate)

if(RUSKY_PARTY)
add_crates(list(/datum/supply_packs/organic/party), empty_shuttle_turfs)
var/datum/supply_packs/pack = SSshuttle.supply_packs[/datum/supply_packs/organic/party]
pack.generate(pick_n_take(empty_shuttle_turfs))
shuttle_spawns.Add(/mob/living/simple_animal/hostile/russian)
shuttle_spawns.Add(/mob/living/simple_animal/hostile/russian/ranged) //drops a mateba
shuttle_spawns.Add(/mob/living/simple_animal/hostile/bear)
Expand All @@ -109,7 +111,8 @@
shuttle_spawns.Add(/mob/living/simple_animal/hostile/bear)

if(SPIDER_GIFT)
add_crates(list(/datum/supply_packs/emergency/specialops), empty_shuttle_turfs)
var/datum/supply_packs/pack = SSshuttle.supply_packs[/datum/supply_packs/emergency/specialops]
pack.generate(pick_n_take(empty_shuttle_turfs))
shuttle_spawns.Add(/mob/living/simple_animal/hostile/poison/giant_spider)
shuttle_spawns.Add(/mob/living/simple_animal/hostile/poison/giant_spider)
shuttle_spawns.Add(/mob/living/simple_animal/hostile/poison/giant_spider/nurse)
Expand Down Expand Up @@ -167,7 +170,9 @@
/datum/supply_packs/science/plasma,
/datum/supply_packs/medical/supplies
)
add_crates(crate_types, empty_shuttle_turfs)
for(var/crate in crate_types)
var/datum/supply_packs/pack = SSshuttle.supply_packs[crate]
pack.generate(pick_n_take(empty_shuttle_turfs))

for(var/i=0,i<5,i++)
var/turf/T = pick(empty_shuttle_turfs)
Expand All @@ -184,17 +189,6 @@
var/spawn_type = pick_n_take(shuttle_spawns)
new spawn_type(T)

/datum/round_event/shuttle_loan/proc/add_crates(list/crate_types, list/turfs)
for(var/crate_type in crate_types)
var/turf/T = pick_n_take(turfs)
var/datum/supply_packs/sp_obj = new crate_type()
var/atom/Crate = new sp_obj.containertype(T)
Crate.name = sp_obj.crate_name
for(var/type_path in sp_obj.contains)
var/atom/A = new type_path(Crate)
if(sp_obj.amount && A.vars.Find("amount") && A:amount)
A:amount = sp_obj.amount

#undef HIJACK_SYNDIE
#undef RUSKY_PARTY
#undef SPIDER_GIFT
Expand Down

0 comments on commit f89c101

Please sign in to comment.