Economy part 2 - Vendors

This commit is contained in:
QuoteFox
2021-02-04 12:42:50 +00:00
parent 6c16353be5
commit 5584bb9522
29 changed files with 221 additions and 66 deletions
+1
View File
@@ -45,6 +45,7 @@
item_state = "sluthailer"
aggressiveness = 0 //can't have your pets being mean!
actions_types = list(/datum/action/item_action/halt)
price = 5
/obj/item/clothing/mask/gas/sechailer/slut/attack_hand(mob/user)
if(iscarbon(user))
@@ -635,6 +635,7 @@
icon_state = "coatsecuritypink"
item_state = "coatsecuritypink"
hoodtype = /obj/item/clothing/head/hooded/winterhood/security/pink
price = 5
/obj/item/clothing/suit/hooded/wintercoat/security/Initialize()
. = ..()
@@ -30,6 +30,7 @@
icon_state = "rsecuritypink"
item_state = "r_suit"
item_color = "rsecuritypink"
price = 3
/obj/item/clothing/under/rank/security/skirt
name = "security jumpskirt"
desc = "A \"tactical\" security jumpsuit with the legs replaced by a skirt."
@@ -46,6 +47,7 @@
item_state = "secslutskirt"
item_color = null //i dont understand what item_color even is, apparently setting it to null means it won't change color in a washing machine?
mutantrace_variation = NO_MUTANTRACE_VARIATION //look at the first two comments in vg_under.dm
price = 3
/obj/item/clothing/under/rank/security/skirt/slut/pink
desc = "A \"\"\"tactical\"\"\" security jumpsuit with the legs replaced by a skirt. No matter how you adjust it, it always feels a little too small. This one seems to have an experimental color scheme."
icon_state = "secslutskirtpink"
@@ -59,6 +61,7 @@
can_adjust = FALSE
body_parts_covered = CHEST|GROIN
mutantrace_variation = NO_MUTANTRACE_VARIATION
price = 5
/obj/item/clothing/under/rank/warden
@@ -217,6 +217,7 @@
resistance_flags = FREEZE_PROOF
isGlass = FALSE
foodtype = BREAKFAST
price = 2
//Used by MREs
/obj/item/reagent_containers/food/drinks/coffee/type2
@@ -240,6 +241,7 @@
icon_state = "tea"
item_state = "coffee"
spillable = TRUE
price = 2
/* Doesn't exist lol
/datum/chemical_reaction/catnip_tea
@@ -259,6 +261,7 @@
name = "Duke Purple tea"
desc = "An insult to Duke Purple is an insult to the Space Queen! Any proper gentleman will fight you, if you sully this tea."
list_reagents = list(/datum/reagent/consumable/tea = 30)
price = 2
/obj/item/reagent_containers/food/drinks/mug/coco
name = "Dutch hot coco"
@@ -276,6 +279,7 @@
list_reagents = list(/datum/reagent/consumable/dry_ramen = 30)
foodtype = GRAIN
isGlass = FALSE
price = 3
/obj/item/reagent_containers/food/drinks/beer
name = "space beer"
@@ -414,6 +418,7 @@
reagent_flags = NONE
spillable = FALSE
isGlass = FALSE
price = 2
/obj/item/reagent_containers/food/drinks/soda_cans/suicide_act(mob/living/carbon/user)
user.visible_message("<span class='suicide'>[user] is trying to eat \the [src]! It looks like [user.p_theyre()] trying to commit suicide!</span>")
@@ -538,3 +543,4 @@
icon_state = "monkey_energy"
list_reagents = list(/datum/reagent/consumable/monkey_energy = 50)
foodtype = SUGAR | JUNKFOOD
price = 3
@@ -12,6 +12,7 @@
filling_color = "#D2691E"
tastes = list("candy" = 1)
foodtype = JUNKFOOD | SUGAR
price = 2
/obj/item/reagent_containers/food/snacks/sosjerky
name = "\improper Scaredy's Private Reserve Beef Jerky"
@@ -23,6 +24,7 @@
filling_color = "#8B0000"
tastes = list("dried meat" = 1)
foodtype = JUNKFOOD | MEAT | SUGAR
price = 3
/obj/item/reagent_containers/food/snacks/sosjerky/healthy
name = "homemade beef jerky"
@@ -41,6 +43,7 @@
filling_color = "#FFD700"
tastes = list("salt" = 1, "crisps" = 1)
foodtype = JUNKFOOD | FRIED
price = 2
/obj/item/reagent_containers/food/snacks/no_raisin
name = "4no raisins"
@@ -52,6 +55,7 @@
filling_color = "#8B0000"
tastes = list("dried raisins" = 1)
foodtype = JUNKFOOD | FRUIT | SUGAR
price = 2
/obj/item/reagent_containers/food/snacks/no_raisin/healthy
name = "homemade raisins"
@@ -68,6 +72,7 @@
junkiness = 25
filling_color = "#FFD700"
foodtype = JUNKFOOD | GRAIN | SUGAR
price = 4
/obj/item/reagent_containers/food/snacks/cheesiehonkers
name = "cheesie honkers"
@@ -79,6 +84,7 @@
filling_color = "#FFD700"
tastes = list("cheese" = 5, "crisps" = 2)
foodtype = JUNKFOOD | DAIRY | SUGAR
price = 4
/obj/item/reagent_containers/food/snacks/soyfood
name = "Soyfood"
@@ -90,6 +96,7 @@
filling_color = "#FFD700"
tastes = list("nanomachines" = 2, "soybeans" = 5)
foodtype = JUNKFOOD | DAIRY | GRAIN
price = 3
/obj/item/reagent_containers/food/snacks/syndicake
name = "syndi-cakes"
@@ -100,6 +107,7 @@
filling_color = "#F5F5DC"
tastes = list("sweetness" = 3, "cake" = 1)
foodtype = GRAIN | FRUIT | VEGETABLES
price = 5
/obj/item/reagent_containers/food/snacks/carbonnanotube_noodles
name = "carbon nanotube noodles"
@@ -111,3 +119,4 @@
filling_color = "#FFD700"
tastes = list("charcoal" = 1, "spiciness" = 3, "soysauce" = 3)
foodtype = GRAIN | VEGETABLES
price = 3
@@ -336,6 +336,7 @@
volume = 50
amount_per_transfer_from_this = 10
container_HP = 1
price = 1
/obj/item/reagent_containers/glass/beaker/waterbottle/Initialize()
beaker_weakness_bitflag |= TEMP_WEAK
@@ -251,7 +251,9 @@
/obj/item/reagent_containers/pill/penis_enlargement
name = "penis enlargement pill"
list_reagents = list(/datum/reagent/fermi/penis_enlarger = 10)
price = 4
/obj/item/reagent_containers/pill/breast_enlargement
name = "breast enlargement pill"
list_reagents = list(/datum/reagent/fermi/breast_enlarger = 10)
price = 4
+135 -39
View File
@@ -21,6 +21,8 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C
var/product_path = null
var/amount = 0
var/max_amount = 0
var/price = 0
/obj/machinery/vending
name = "\improper Vendomat"
@@ -65,12 +67,20 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C
var/scan_id = 1
var/obj/item/coin/coin
var/obj/item/stack/spacecash/bill
var/global/vending_cache = list() //used for storing the icons of items being vended
var/dish_quants = list() //used by the snack machine's custom compartment to count dishes.
var/obj/item/vending_refill/refill_canister = null //The type of refill canisters used by this machine.
var/obj/item/vending_refill/refill_canister = null //The type of refill canisters used by this machine
//hyper economy stuff
var/credits = 0
var/baseprice = 0
var/menu = 1
var/datum/bank_account/bankid
var/datum/data/vending_product/buying
var/free = FALSE //everythings free!
/obj/machinery/vending/Initialize()
var/build_inv = FALSE
@@ -153,9 +163,18 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C
amount = 0
var/atom/temp = typepath
var/obj/item/product = typepath
var/datum/data/vending_product/R = new /datum/data/vending_product()
R.name = initial(temp.name)
R.product_path = typepath
R.price = baseprice
if(product) //its a item!
if((initial(product.price)))
R.price = initial(product.price)
else
R.price = baseprice
if(free)
R.price = 0
if(!start_empty)
R.amount = amount
R.max_amount = amount
@@ -228,6 +247,16 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C
if(panel_open && is_wire_tool(I))
wires.interact(user)
return
else if(istype(I, /obj/item/stack/credits))
var/obj/item/stack/credits/cred = I
to_chat(usr, "<span class='notice'>You insert [cred] into [src].</span>")
credits = credits+cred.amount
src.ui_interact(usr)
del(cred)
/* we dont use this currency anymore!
else if(istype(I, /obj/item/coin))
if(coin)
to_chat(user, "<span class='warning'>[src] already has [coin] inserted</span>")
@@ -258,6 +287,7 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C
bill = new S.type(src, 1)
to_chat(user, "<span class='notice'>You insert [I] into [src].</span>")
return
*/
else if(refill_canister && istype(I, refill_canister))
if (!panel_open)
to_chat(user, "<span class='notice'>You should probably unscrew the service panel first.</span>")
@@ -320,44 +350,61 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C
/obj/machinery/vending/ui_interact(mob/user)
var/dat = ""
dat += "<h3>Select an item</h3>"
dat += "<div class='statusDisplay'>"
if(!product_records.len)
dat += "<font color = 'red'>No product loaded!</font>"
else
var/list/display_records = product_records
if(extended_inventory)
display_records = product_records + hidden_records
if(coin || bill)
display_records = product_records + coin_records
if((coin || bill) && extended_inventory)
display_records = product_records + hidden_records + coin_records
dat += "<table>"
for (var/datum/data/vending_product/R in display_records)
dat += "<tr><td><img src='data:image/jpeg;base64,[GetIconForProduct(R)]'/></td>"
dat += "<td style=\"width: 100%\"><b>[sanitize(R.name)]</b></td>"
if(R.amount > 0)
dat += "<td><b>[R.amount]&nbsp;</b></td><td><a href='byond://?src=[REF(src)];vend=[REF(R)]'>Vend</a></td>"
switch(menu)
if(1)
dat += "<h3>Select an item</h3><p>"
if(!credits)
dat += "<i>Inserted credits: $[credits] </i>&nbsp;&nbsp;<span class='linkOff'>remove</span>"
else
dat += "<td>0&nbsp;</td><td><span class='linkOff'>Vend</span></td>"
dat += "</tr>"
dat += "</table>"
dat += "</div>"
if(premium.len > 0)
dat += "<b>Change Return:</b> "
if (coin || bill)
dat += "[(coin ? coin : "")][(bill ? bill : "")]&nbsp;&nbsp;<a href='byond://?src=[REF(src)];remove_coin=1'>Remove</a>"
else
dat += "<i>No money</i>&nbsp;&nbsp;<span class='linkOff'>Remove</span>"
if(istype(src, /obj/machinery/vending/snack))
dat += "<h3>Chef's Food Selection</h3>"
dat += "<div class='statusDisplay'>"
for (var/O in dish_quants)
if(dish_quants[O] > 0)
var/N = dish_quants[O]
dat += "<a href='byond://?src=[REF(src)];dispense=[sanitize(O)]'>Dispense</A> "
dat += "<B>[capitalize(O)]: [N]</B><br>"
dat += "</div>"
dat += "<i>Inserted credits: $[credits] </i><a href='byond://?src=[REF(src)];removecredits=1'>remove</A>"
dat += "<div class='statusDisplay'>"
if(!product_records.len)
dat += "<font color = 'red'>No product loaded!</font>"
else
var/list/display_records = product_records
if(extended_inventory) //hacking shows all inventory now since coins arent worth anything.
display_records = product_records + hidden_records + coin_records
else
display_records = product_records
dat += "<table>"
for (var/datum/data/vending_product/R in display_records)
dat += "<tr><td><img src='data:image/jpeg;base64,[GetIconForProduct(R)]'/></td>"
dat += "<td style=\"width: 10%\"><b>$[R.price]</b></td>"
dat += "<td style=\"width: 100%\">[sanitize(R.name)]</td>"
if(R.amount > 0)
dat += "<td><b>[R.amount]&nbsp;</b></td><td><a href='byond://?src=[REF(src)];vend=[REF(R)]'>[!R.price ? "Vend" : "Buy"]</a></td>"
else
dat += "<td>0&nbsp;</td><td><span class='linkOff'>Vend</span></td>"
dat += "</tr>"
dat += "</table>"
dat += "</div>"
if(premium.len > 0)
dat += "<b>Change Return:</b> "
if (coin || bill)
dat += "[(coin ? coin : "")][(bill ? bill : "")]&nbsp;&nbsp;<a href='byond://?src=[REF(src)];remove_coin=1'>Remove</a>"
else
dat += "<i>No money</i>&nbsp;&nbsp;<span class='linkOff'>Remove</span>"
if(istype(src, /obj/machinery/vending/snack))
dat += "<h3>Chef's Food Selection</h3>"
dat += "<div class='statusDisplay'>"
for (var/O in dish_quants)
if(dish_quants[O] > 0)
var/N = dish_quants[O]
dat += "<a href='byond://?src=[REF(src)];dispense=[sanitize(O)]'>Dispense</A> "
dat += "<B>[capitalize(O)]: [N]</B><br>"
dat += "</div>"
if(2) //hyper economy purchase item menu
dat += "<center>"
if(buying)
dat += "<h3>Purchase [buying.name]</h3><p>"
else
dat += "<h3>Purchase Item</h3><p>"
dat += "<i>Inserted credits: $[credits]</i><p>"
dat += "Not enough credits to purchase, please insert credits or swipe your card to purchase!<p>"
dat += "<a href='byond://?src=[REF(src)];idpay=1;vend=[REF(buying)]'>Pay-By-Card</a>"
dat += "<a href='byond://?src=[REF(src)];return=1]'>Return</a>"
dat += "</center>"
var/datum/browser/popup = new(user, "vending", (name))
popup.set_content(dat)
@@ -389,6 +436,12 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C
to_chat(usr, "<span class='notice'>You remove [bill] from [src].</span>")
bill = null
if(href_list["removecredits"])
var/obj/item/stack/credits/C = new /obj/item/stack/credits/(loc)
C.amount = credits
credits = 0 //empty the machine
if(usr.put_in_hands(C))
to_chat(usr, "<span class='notice'>You take [C] out of the ATM.</span>")
usr.set_machine(src)
@@ -408,6 +461,22 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C
updateUsrDialog()
return
if(href_list["idpay"])
var/obj/item/card/id/I = usr.get_idcard(TRUE)
if(I)
if(I.registered_account)
bankid = I.registered_account
else
to_chat(usr, "<span class='notice'>The vending machine fails to read your bank account!</span>")
else
to_chat(usr, "<span class='notice'>The vending machine fails to read your card!</span>")
if(href_list["return"])
menu = 1
vend_ready = 1
updateUsrDialog()
return
if((href_list["vend"]) && (vend_ready))
if(panel_open)
to_chat(usr, "<span class='notice'>The vending machine cannot dispense products while its service panel is open!</span>")
@@ -421,6 +490,29 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C
vend_ready = 0 //One thing at a time!!
var/datum/data/vending_product/R = locate(href_list["vend"])
buying = R
//check if they can afford it, if not open the next menu
if(R.price > credits)
menu = 2 //second menu
updateUsrDialog()
vend_ready = 1
if(bankid && R == buying) //if we have a bank id, and we are trying to buy the same thing!
if(bankid.account_balance >= R.price)
bankid.account_balance -= R.price //take the money from the account.
menu = 1
to_chat(usr, "<span class='notice'>You [R.name] via the provided bank account!</span>")
bankid = null //so noone can buy from your account after youve purchased stuff
else
to_chat(usr, "<span class='notice'>You do not have enough money in the bank account to purchase [R.name]!</span>")
return
else
return
else
credits -= R.price
menu = 1
if(!R || !istype(R) || !R.product_path)
vend_ready = 1
return
@@ -470,9 +562,11 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C
last_reply = world.time
use_power(5)
if(icon_vend) //Show the vending animation if needed
flick(icon_vend,src)
var/vended = new R.product_path(get_turf(src))
playsound(src, 'sound/items/vending.ogg', 50, 1, -1)
if(usr.CanReach(src))
if(usr.put_in_hands(vended))
to_chat(usr, "<span class='notice'>You take [R.name] out of the slot.</span>")
@@ -507,8 +601,10 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C
speak(slogan)
last_slogan = world.time
/* no freebies
if(shoot_inventory && prob(shoot_inventory_chance))
throw_item()
*/
/obj/machinery/vending/proc/speak(message)
if(stat & (BROKEN|NOPOWER))
+1
View File
@@ -40,6 +40,7 @@
product_ads = "Drink up!;Booze is good for you!;Alcohol is humanity's best friend.;Quite delighted to serve you!;Care for a nice, cold beer?;Nothing cures you like booze!;Have a sip!;Have a drink!;Have a beer!;Beer is good for you!;Only the finest alcohol!;Best quality booze since 2053!;Award-winning wine!;Maximum alcohol!;Man loves beer.;A toast for progress!"
req_access = list(ACCESS_BAR)
refill_canister = /obj/item/vending_refill/boozeomat
free = TRUE
/obj/machinery/vending/boozeomat/all_access
desc = "A technological marvel, supposedly able to mix just the mixture you'd like to drink the moment you ask for one. This model appears to have no access restrictions."
+1
View File
@@ -1,5 +1,6 @@
/obj/machinery/vending/cigarette
name = "\improper ShadyCigs Deluxe"
baseprice = 3
desc = "If you want to get cancer, might as well do it in style."
product_slogans = "Space cigs taste good like a cigarette should.;I'd rather toolbox than switch.;Smoke!;Don't believe the reports - smoke today!"
product_ads = "Probably not bad for you!;Don't believe the scientists!;It's good for you!;Don't quit, buy more!;Smoke!;Nicotine heaven.;Best cigarettes since 2150.;Award-winning cigs."
+1
View File
@@ -146,6 +146,7 @@
/obj/item/bluespace_thread = 3,
/obj/item/clothing/under/lawyer/galaxy_blue = 3)
refill_canister = /obj/item/vending_refill/clothing
baseprice = 2
/obj/item/vending_refill/clothing
machine_name = "ClothesMate"
+6
View File
@@ -19,6 +19,8 @@
refill_canister = /obj/item/vending_refill/snack
var/chef_compartment_access = "28" //ACCESS_KITCHEN
baseprice = 3
/obj/item/vending_refill/snack
machine_name = "Getmore Chocolate Corp"
@@ -103,11 +105,15 @@
/obj/machinery/vending/snack/blue
icon_state = "snackblue"
/obj/machinery/vending/snack/orange
icon_state = "snackorange"
/obj/machinery/vending/snack/green
icon_state = "snackgreen"
/obj/machinery/vending/snack/teal
icon_state = "snackteal"