Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requisition de-bork batch #13259

Merged
merged 1 commit into from Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions code/modules/economy/requisition/rc_aid.dm
Expand Up @@ -54,7 +54,8 @@ ABSTRACT_TYPE(/datum/req_contract/aid)

/datum/rc_entry/stack/steelsheet
name = "NT-spec steel sheet"
typepath = /obj/item/sheet/steel
typepath = /obj/item/sheet
mat_id = "steel"
feemod = 30

ABSTRACT_TYPE(/datum/rc_entry/item/basictool)
Expand Down Expand Up @@ -326,9 +327,9 @@ ABSTRACT_TYPE(/datum/rc_entry/item/surgical)

switch(tilter)
if("food","rations")
src.rc_entries += rc_buildentry(/datum/rc_entry/item/literallyanyfood,rand(30,48))
src.rc_entries += rc_buildentry(/datum/rc_entry/food/any,rand(30,48))
if("food and water")
src.rc_entries += rc_buildentry(/datum/rc_entry/item/literallyanyfood,rand(24,40))
src.rc_entries += rc_buildentry(/datum/rc_entry/food/any,rand(24,40))
src.rc_entries += rc_buildentry(/datum/rc_entry/reagent/water,rand(18,36)*10)
if("furnace fuel")
src.rc_entries += rc_buildentry(/datum/rc_entry/stack/char,rand(24,36))
Expand Down
30 changes: 14 additions & 16 deletions code/modules/economy/requisition/rc_civilian.dm
Expand Up @@ -197,7 +197,7 @@ ABSTRACT_TYPE(/datum/rc_entry/reagent/caterdrink)
if(prob(30))
src.rc_entries += rc_buildentry(/datum/rc_entry/item/headset,crewcount)
if(prob(50)) //turns out they need something to eat too
src.rc_entries += rc_buildentry(/datum/rc_entry/item/literallyanyfood,crewcount)
src.rc_entries += rc_buildentry(/datum/rc_entry/food/any,crewcount)
src.flavor_desc += " Food would also be appreciated."
if(prob(70)) src.rc_entries += rc_buildentry(/datum/rc_entry/reagent/water,crewcount*10*rand(1,3))
//job related gearsets could also be added here sometimes
Expand Down Expand Up @@ -260,7 +260,7 @@ ABSTRACT_TYPE(/datum/rc_entry/reagent/caterdrink)
typepath = /obj/item/device/radio/headset
feemod = 940

/datum/rc_entry/item/literallyanyfood
/datum/rc_entry/food/any
name = "solid food, preferably nutritious"
typepath = /obj/item/reagent_containers/food/snacks
feemod = 250
Expand Down Expand Up @@ -307,16 +307,16 @@ ABSTRACT_TYPE(/datum/rc_entry/reagent/caterdrink)
src.payout += rand(0,50) * 10

if (prob(70)) //pizza party
src.rc_entries += rc_buildentry(/datum/rc_entry/stack/pizza,rand(2,3)*6)
src.rc_entries += rc_buildentry(/datum/rc_entry/food/pizza,rand(2,3)*6)
src.rc_entries += rc_buildentry(/datum/rc_entry/reagent/cola,rand(10,20)*10)

switch (rand(1, 50)) //Special Outcomes Zone
if (1)
src.rc_entries += rc_buildentry(/datum/rc_entry/item/chaps,rand(3,6))
if (2 to 6)
src.rc_entries += rc_buildentry(/datum/rc_entry/item/grapes,rand(3,6))
src.rc_entries += rc_buildentry(/datum/rc_entry/food/grapes,rand(3,6))
if (7 to 11)
src.rc_entries += rc_buildentry(/datum/rc_entry/item/banana,rand(4,8))
src.rc_entries += rc_buildentry(/datum/rc_entry/food/banana,rand(4,8))
if (12 to 16)
src.rc_entries += rc_buildentry(/datum/rc_entry/item/cannabis,rand(4,8))
if (17 to 21)
Expand All @@ -329,9 +329,9 @@ ABSTRACT_TYPE(/datum/rc_entry/reagent/caterdrink)
if(!length(src.rc_entries)) src.rc_entries += rc_buildentry(/datum/rc_entry/item/paperhat,rand(6,12)) //fallback

if(prob(70)) //cookies or cakes?
src.rc_entries += rc_buildentry(/datum/rc_entry/item/cake,1+prob(20))
src.rc_entries += rc_buildentry(/datum/rc_entry/food/cake,1+prob(20))
else //yep cookies
src.rc_entries += rc_buildentry(/datum/rc_entry/item/cookie,rand(2,4)*6)
src.rc_entries += rc_buildentry(/datum/rc_entry/food/cookie,rand(2,4)*6)

var/bonusducks
if(prob(50))
Expand Down Expand Up @@ -385,17 +385,17 @@ ABSTRACT_TYPE(/datum/rc_entry/reagent/caterdrink)
typepath = /obj/item/gift
feemod = 600

/datum/rc_entry/item/cake
/datum/rc_entry/food/cake
name = "cake"
typepath = /obj/item/reagent_containers/food/snacks/cake
feemod = 2500

/datum/rc_entry/item/cookie
/datum/rc_entry/food/cookie
name = "cookie"
typepath = /obj/item/reagent_containers/food/snacks/cookie
feemod = 600

/datum/rc_entry/stack/pizza
/datum/rc_entry/food/pizza
name = "slices' worth of pizza"
typepath = /obj/item/reagent_containers/food/snacks/pizza
feemod = 120
Expand All @@ -410,17 +410,15 @@ ABSTRACT_TYPE(/datum/rc_entry/reagent/caterdrink)
typepath = /obj/item/clothing/under/gimmick/chaps
feemod = 5000

/datum/rc_entry/item/grapes
/datum/rc_entry/food/grapes
name = "grapes"
typepath = /obj/item/reagent_containers/food/snacks/plant/grape
commodity = /datum/commodity/produce
feemod = 400
feemod = 450

/datum/rc_entry/item/banana
/datum/rc_entry/food/banana
name = "banana"
typepath = /obj/item/reagent_containers/food/snacks/plant/banana
commodity = /datum/commodity/produce
feemod = 250
feemod = 300

/datum/rc_entry/item/cannabis
name = "cannabis"
Expand Down
16 changes: 8 additions & 8 deletions code/modules/economy/requisition/rc_special.dm
Expand Up @@ -149,7 +149,7 @@ ABSTRACT_TYPE(/datum/req_contract/special/surgery)
src.rc_entries += rc_buildentry(/datum/rc_entry/item/megaweed,1)
src.rc_entries += rc_buildentry(/datum/rc_entry/item/whiteweed,1)
src.rc_entries += rc_buildentry(/datum/rc_entry/item/omegaweed,1)
src.rc_entries += rc_buildentry(/datum/rc_entry/stack/pizza/spacer,6)
src.rc_entries += rc_buildentry(/datum/rc_entry/food/pizza/spacer,6)
..()

/datum/rc_entry/item
Expand All @@ -163,7 +163,7 @@ ABSTRACT_TYPE(/datum/req_contract/special/surgery)
name = "Omega Weed"
typepath = /obj/item/plant/herb/cannabis/omega

/datum/rc_entry/stack/pizza/spacer
/datum/rc_entry/food/pizza/spacer
name = "Pizza Hexa-Subsections (May Be Unseparated)"


Expand All @@ -179,11 +179,11 @@ ABSTRACT_TYPE(/datum/req_contract/special/surgery)
payout = 3300

New()
src.rc_entries += rc_buildentry(/datum/rc_entry/stack/pizza,rand(20,30)*6)
src.rc_entries += rc_buildentry(/datum/rc_entry/food/pizza,rand(20,30)*6)
..()

//contract below defines the details itself based on variety of order - this is just a dummy so as not to use an abstract type
/datum/rc_entry/item/mealfood
/datum/rc_entry/food/mealfood

ABSTRACT_TYPE(/datum/req_contract/special/chef)
/datum/req_contract/special/chef
Expand All @@ -200,7 +200,7 @@ ABSTRACT_TYPE(/datum/req_contract/special/chef)
New()
src.build_foodlist()
for(var/i in 1 to rand(3,6))
var/datum/rc_entry/item/nom = new /datum/rc_entry/item/mealfood
var/datum/rc_entry/item/nom = new /datum/rc_entry/food/mealfood
nom.typepath = pick(src.cornucopia)
nom.name = src.name_of_food[nom.typepath]
nom.count = pick(60; 1, 30; 2, 10; 3)
Expand All @@ -213,7 +213,7 @@ ABSTRACT_TYPE(/datum/req_contract/special/chef)
New()
src.build_foodlist()
for(var/i in 1 to rand(3,6))
var/datum/rc_entry/item/nom = new /datum/rc_entry/item/mealfood
var/datum/rc_entry/item/nom = new /datum/rc_entry/food/mealfood
nom.typepath = pick(src.cornucopia)
nom.name = src.name_of_food[nom.typepath]
nom.count = pick(60; 1, 40; 2)
Expand All @@ -226,7 +226,7 @@ ABSTRACT_TYPE(/datum/req_contract/special/chef)
New()
src.build_foodlist()
for(var/i in 1 to rand(3,6))
var/datum/rc_entry/item/nom = new /datum/rc_entry/item/mealfood
var/datum/rc_entry/item/nom = new /datum/rc_entry/food/mealfood
nom.typepath = pick(src.cornucopia)
nom.name = src.name_of_food[nom.typepath]
nom.count = pick(60; 1, 40; 2)
Expand All @@ -239,7 +239,7 @@ ABSTRACT_TYPE(/datum/req_contract/special/chef)
New()
src.build_foodlist()
for(var/i in 1 to rand(3,6))
var/datum/rc_entry/item/nom = new /datum/rc_entry/item/mealfood
var/datum/rc_entry/item/nom = new /datum/rc_entry/food/mealfood
nom.typepath = pick(src.cornucopia)
nom.name = src.name_of_food[nom.typepath]
nom.count = pick(40; 1, 40; 2, 20; 3)
Expand Down
28 changes: 28 additions & 0 deletions code/modules/economy/requisition/requisition_contracts.dm
Expand Up @@ -98,6 +98,29 @@ ABSTRACT_TYPE(/datum/rc_entry/item)
src.rollcount++
. = TRUE

ABSTRACT_TYPE(/datum/rc_entry/food)
///Food item entry, used to properly detect food integrity.
/datum/rc_entry/food
entryclass = RC_ITEM
///Type path of the item the entry is looking for.
var/typepath
///If true, requires precise path; if false (default), sub-paths are accepted.
var/exactpath = FALSE
///Must-be-whole switch. If true, food must be at initial bites_left value and is counted by whole units; if false, it is counted by bites left.
var/must_be_whole = TRUE

rc_eval(obj/item/reagent_containers/food/snacks/eval_item)
. = ..()
if(rollcount >= count) return // Standard skip-if-complete
if(src.exactpath && eval_item.type != typepath) return // More fussy type evaluation
else if(!istype(eval_item,typepath)) return // Regular type evaluation
if(must_be_whole)
if(eval_item.bites_left != initial(eval_item.bites_left)) return
src.rollcount++
else
src.rollcount += eval_item.bites_left
. = TRUE

ABSTRACT_TYPE(/datum/rc_entry/stack)
///Stackable item entry. Remarkably, used for items that can be stacked.
/datum/rc_entry/stack
Expand All @@ -108,6 +131,8 @@ ABSTRACT_TYPE(/datum/rc_entry/stack)
var/typepath_alt
///Commodity path. If defined, will augment the per-item payout with the highest market rate for that commodity, and set the type path if not initially specified.
var/commodity
///Material ID string. If defined, will require the stack's material's mat_id to match the specified mat_id.
var/mat_id

New()
if(src.commodity) // Fetch configuration data from commodity if specified
Expand All @@ -121,6 +146,9 @@ ABSTRACT_TYPE(/datum/rc_entry/stack)
. = ..()
if(rollcount >= count) return // Standard skip-if-complete
if(!istype(eval_item)) return // If it's not an item, it's not a stackable
if(mat_id) // If we're checking for materials, do that here with a tag comparison
if(!eval_item.material || eval_item.material.mat_id != src.mat_id)
return
if(istype(eval_item,typepath) || (typepath_alt && istype(eval_item,typepath_alt)))
rollcount += eval_item.amount
. = TRUE // Let manager know passed eval item is claimed by contract
Expand Down