Snow is falling...

- Replaced old dead NanoUI for casino prize dispenser with a new modern TGUI interface
- Fixed casino communications, now there are options for casino crew to discuss how to steal visitors th- generously give folks a good time, over private channel
- Fixed Goose king and queen crowns and also made some new subtypes that might get some effects added to them in advance for an approaching date...
This commit is contained in:
Shadowfire
2020-12-12 12:12:05 +01:00
parent e16683d60d
commit aa865e671d
7 changed files with 549 additions and 625 deletions
-622
View File
@@ -984,625 +984,3 @@
spawn_money(round(I:worth/2.5), src.loc)
src.attack_hand(user)
qdel(I)
/////////////CASINO PRIZE DISPENSER////////////////////////
/obj/machinery/casino_prize_dispenser //WIP sprites and variables and prize lists
name = "Casino Prize Exchanger"
desc = "Exchange your chips to obtain wonderful prizes! Hoepfully you'll get to keep some of them for a while."
icon = 'icons/obj/casino_ch.dmi'
icon_state ="casino_prize_dispenser"
var/icon_vend ="casino_prize_dispenser-vend"
anchored = 1
opacity = 0
// Vending-related
var/active = 1 //No sales pitches if off!
var/vend_ready = 1 //Are we ready to vend?? Is it time??
var/vend_delay = 40 //How long does it take to vend?
var/datum/stored_item/vending_product/currently_vending = null // What we're requesting payment for right now
var/category_selection = null
var/currently_selecting = null //Which category of prizes is currently displayed
var/prize_payout_mode = null //Is the currently selected prize being given or just logged?
var/status_message = "" // Status screen messages like "insufficient funds", displayed in NanoUI
var/status_error = 0 // Set to 1 if status_message is an error
var/list/list_weapons = list()
var/list/list_gear = list()
var/list/list_clothing = list()
var/list/list_misc = list()
var/list/list_drinks = list()
var/list/list_pets = list()
var/list/prices = list() // Prices for each item, list(/type/path = price), items not in the list don't have a price.
// List of vending_product items available.
var/list/weapons_product_records = list()
var/list/gear_product_records = list()
var/list/clothing_product_records = list()
var/list/misc_product_records = list()
var/list/drinks_product_records = list()
var/list/pets_product_records = list()
var/category_weapons = 1 //For listing categories, if false then prizes of this categories cant be obtained nor bought for post-shift enjoyment
var/category_gear = 1 //If 1 prizes will be only logged
var/category_clothing = 1 //If 2 prizes will both be logged and spawned
var/category_misc = 1
var/category_drinks = 1
var/category_pets = 1
list_weapons = list(
/obj/item/weapon/scepter,
/obj/item/weapon/melee/chainofcommand,
/obj/item/weapon/gun/energy/sizegun,
/obj/item/weapon/gun/energy/particle/advanced,
/obj/item/weapon/gun/energy/temperature,
/obj/item/weapon/gun/energy/alien,
/obj/item/weapon/gun/energy/floragun,
/obj/item/weapon/gun/energy/netgun
)
list_gear = list(
/obj/item/weapon/weldingtool/experimental,
/obj/item/weapon/storage/belt/utility/alien,
/obj/item/clothing/suit/armor/alien,
/obj/item/clothing/glasses/monocoole,
/obj/item/clothing/accessory/chameleon,
/obj/item/weapon/reagent_containers/spray/chemsprayer,
/obj/item/weapon/reagent_containers/glass/beaker/bluespace,
/obj/item/weapon/reagent_containers/glass/beaker/noreact
)
list_clothing = list(
/obj/item/clothing/head/soft/purple/wah,
/obj/item/clothing/mask/shark,
/obj/item/clothing/mask/pig,
/obj/item/clothing/mask/luchador,
/obj/item/clothing/mask/horsehead,
/obj/item/clothing/mask/goblin,
/obj/item/clothing/mask/fakemoustache,
/obj/item/clothing/mask/dolphin,
/obj/item/clothing/mask/demon,
/obj/item/clothing/under/chameleon,
/obj/item/clothing/suit/storage/hooded/ian_costume,
/obj/item/clothing/suit/storage/hooded/carp_costume,
/obj/item/weapon/storage/box/casino/costume_whitebunny,
/obj/item/weapon/storage/box/casino/costume_blackbunny,
/obj/item/weapon/storage/box/casino/costume_sexymime,
/obj/item/weapon/storage/box/casino/costume_sexyclown,
/obj/item/weapon/storage/box/casino/costume_nyangirl,
/obj/item/weapon/storage/box/casino/costume_wizard,
/obj/item/weapon/storage/box/casino/costume_chicken,
/obj/item/weapon/storage/box/casino/costume_gladiator,
/obj/item/weapon/storage/box/casino/costume_pirate,
/obj/item/weapon/storage/box/casino/costume_commie,
/obj/item/weapon/storage/box/casino/costume_imperiummonk,
/obj/item/weapon/storage/box/casino/costume_plaguedoctor,
/obj/item/weapon/storage/box/casino/costume_cutewitch
)
list_misc = list(
/obj/item/toy/sword,
/obj/item/weapon/reagent_containers/spray/waterflower,
/obj/item/toy/stickhorse,
/obj/item/toy/katana,
/obj/item/toy/eight_ball/conch,
/obj/item/toy/eight_ball,
/obj/item/weapon/material/sword/foam,
/obj/item/weapon/storage/box/casino/foamcrossbow,
/obj/item/toy/bosunwhistle,
/obj/item/weapon/reagent_containers/food/drinks/golden_cup,
/obj/item/weapon/storage/fancy/cigar/havana,
/obj/item/weapon/storage/wallet/casino,
/obj/item/weapon/deck/cards/casino
)
list_drinks = list(
/obj/item/weapon/reagent_containers/food/drinks/bottle/redeemersbrew,
/obj/item/weapon/reagent_containers/food/drinks/bottle/pwine,
/obj/item/weapon/reagent_containers/food/drinks/bottle/patron,
/obj/item/weapon/reagent_containers/food/drinks/bottle/holywater,
/obj/item/weapon/reagent_containers/food/drinks/bottle/goldschlager,
/obj/item/weapon/reagent_containers/food/drinks/bottle/champagne,
/obj/item/weapon/reagent_containers/food/drinks/bottle/bottleofnothing,
/obj/item/weapon/reagent_containers/food/drinks/bottle/specialwhiskey,
/obj/item/weapon/reagent_containers/food/drinks/bottle/snaps
)
list_pets = list(
/obj/item/weapon/grenade/spawnergrenade/casino,
/obj/item/weapon/grenade/spawnergrenade/casino/goat,
/obj/item/weapon/grenade/spawnergrenade/casino/armadillo,
/obj/item/weapon/grenade/spawnergrenade/casino/cat,
/obj/item/weapon/grenade/spawnergrenade/casino/chicken,
/obj/item/weapon/grenade/spawnergrenade/casino/cow,
/obj/item/weapon/grenade/spawnergrenade/casino/corgi,
/obj/item/weapon/grenade/spawnergrenade/casino/fox,
/obj/item/weapon/grenade/spawnergrenade/casino/lizard,
/obj/item/weapon/grenade/spawnergrenade/casino/penguin,
/obj/item/weapon/grenade/spawnergrenade/casino/snake,
/obj/item/weapon/grenade/spawnergrenade/casino/yithian,
/obj/item/weapon/grenade/spawnergrenade/casino/tindalos,
/obj/item/weapon/grenade/spawnergrenade/casino/fennec,
/obj/item/weapon/grenade/spawnergrenade/casino/redpanda,
/obj/item/weapon/grenade/spawnergrenade/casino/horse,
/obj/item/weapon/grenade/spawnergrenade/casino/otie,
/obj/item/weapon/grenade/spawnergrenade/casino/otie/chubby,
/obj/item/weapon/grenade/spawnergrenade/casino/zorgoia
)
prices = list(
/obj/item/weapon/scepter = 500,
/obj/item/weapon/melee/chainofcommand = 250,
/obj/item/weapon/gun/energy/sizegun = 100,
/obj/item/weapon/gun/energy/particle/advanced = 500,
/obj/item/weapon/gun/energy/temperature = 250,
/obj/item/weapon/gun/energy/alien = 1000,
/obj/item/weapon/gun/energy/floragun = 250,
/obj/item/weapon/gun/energy/netgun = 500,
/obj/item/weapon/weldingtool/experimental = 500,
/obj/item/weapon/storage/belt/utility/alien = 500,
/obj/item/clothing/suit/armor/alien = 750,
/obj/item/clothing/glasses/monocoole = 1000,
/obj/item/clothing/accessory/chameleon = 250,
/obj/item/weapon/reagent_containers/spray/chemsprayer = 250,
/obj/item/weapon/reagent_containers/glass/beaker/bluespace = 200,
/obj/item/weapon/reagent_containers/glass/beaker/noreact = 200,
/obj/item/clothing/head/soft/purple/wah = 50,
/obj/item/clothing/mask/shark = 50,
/obj/item/clothing/mask/pig = 50,
/obj/item/clothing/mask/luchador = 50,
/obj/item/clothing/mask/horsehead = 50,
/obj/item/clothing/mask/goblin = 50,
/obj/item/clothing/mask/fakemoustache = 50,
/obj/item/clothing/mask/dolphin = 50,
/obj/item/clothing/mask/demon = 50,
/obj/item/clothing/under/chameleon = 250,
/obj/item/clothing/suit/storage/hooded/ian_costume = 50,
/obj/item/clothing/suit/storage/hooded/carp_costume = 50,
/obj/item/weapon/storage/box/casino/costume_whitebunny = 100,
/obj/item/weapon/storage/box/casino/costume_blackbunny = 100,
/obj/item/weapon/storage/box/casino/costume_sexymime = 100,
/obj/item/weapon/storage/box/casino/costume_sexyclown = 100,
/obj/item/weapon/storage/box/casino/costume_nyangirl = 100,
/obj/item/weapon/storage/box/casino/costume_wizard = 100,
/obj/item/weapon/storage/box/casino/costume_chicken = 100,
/obj/item/weapon/storage/box/casino/costume_gladiator = 100,
/obj/item/weapon/storage/box/casino/costume_pirate = 100,
/obj/item/weapon/storage/box/casino/costume_commie = 100,
/obj/item/weapon/storage/box/casino/costume_imperiummonk = 100,
/obj/item/weapon/storage/box/casino/costume_plaguedoctor = 100,
/obj/item/weapon/storage/box/casino/costume_cutewitch = 100,
/obj/item/toy/sword = 50,
/obj/item/weapon/reagent_containers/spray/waterflower = 50,
/obj/item/toy/stickhorse = 50,
/obj/item/toy/katana = 50,
/obj/item/toy/eight_ball/conch = 50,
/obj/item/toy/eight_ball = 50,
/obj/item/weapon/material/sword/foam = 50,
/obj/item/weapon/storage/box/casino/foamcrossbow = 50,
/obj/item/toy/bosunwhistle = 50,
/obj/item/weapon/reagent_containers/food/drinks/golden_cup = 50,
/obj/item/weapon/storage/fancy/cigar/havana = 50,
/obj/item/weapon/storage/wallet/casino = 50,
/obj/item/weapon/deck/cards/casino = 50,
/obj/item/weapon/reagent_containers/food/drinks/bottle/redeemersbrew = 50,
/obj/item/weapon/reagent_containers/food/drinks/bottle/pwine = 50,
/obj/item/weapon/reagent_containers/food/drinks/bottle/patron = 50,
/obj/item/weapon/reagent_containers/food/drinks/bottle/holywater = 50,
/obj/item/weapon/reagent_containers/food/drinks/bottle/goldschlager = 50,
/obj/item/weapon/reagent_containers/food/drinks/bottle/champagne = 50,
/obj/item/weapon/reagent_containers/food/drinks/bottle/bottleofnothing = 50,
/obj/item/weapon/reagent_containers/food/drinks/bottle/specialwhiskey = 50,
/obj/item/weapon/reagent_containers/food/drinks/bottle/snaps = 50,
/obj/item/weapon/grenade/spawnergrenade/casino = 200,
/obj/item/weapon/grenade/spawnergrenade/casino/goat = 150,
/obj/item/weapon/grenade/spawnergrenade/casino/armadillo = 150,
/obj/item/weapon/grenade/spawnergrenade/casino/cat = 150,
/obj/item/weapon/grenade/spawnergrenade/casino/chicken = 200,
/obj/item/weapon/grenade/spawnergrenade/casino/cow = 200,
/obj/item/weapon/grenade/spawnergrenade/casino/corgi = 200,
/obj/item/weapon/grenade/spawnergrenade/casino/fox = 150,
/obj/item/weapon/grenade/spawnergrenade/casino/lizard = 150,
/obj/item/weapon/grenade/spawnergrenade/casino/penguin = 150,
/obj/item/weapon/grenade/spawnergrenade/casino/snake = 200,
/obj/item/weapon/grenade/spawnergrenade/casino/yithian = 200,
/obj/item/weapon/grenade/spawnergrenade/casino/tindalos = 200,
/obj/item/weapon/grenade/spawnergrenade/casino/fennec = 300,
/obj/item/weapon/grenade/spawnergrenade/casino/redpanda = 300,
/obj/item/weapon/grenade/spawnergrenade/casino/horse = 300,
/obj/item/weapon/grenade/spawnergrenade/casino/otie = 500,
/obj/item/weapon/grenade/spawnergrenade/casino/otie/chubby = 500,
/obj/item/weapon/grenade/spawnergrenade/casino/zorgoia = 500
)
var/list/log = list()
var/req_log_access = access_cargo //default access for checking logs is cargo
var/has_logs = 0 //defaults to 0, set to anything else for vendor to have logs
/obj/machinery/casino_prize_dispenser/Initialize()
build_inventory()
/obj/machinery/casino_prize_dispenser/proc/build_inventory() //Awkward yeah
var/list/weapons_products = list(
list(list_weapons, "cat_weapons"))
for(var/current_list in weapons_products)
var/category = current_list[2]
for(var/entry in current_list[1])
var/datum/stored_item/vending_product/product = new/datum/stored_item/vending_product(src, entry)
product.price = (entry in prices) ? prices[entry] : 0
product.category = category
weapons_product_records.Add(product)
var/list/gear_products = list(
list(list_gear, "cat_gear"))
for(var/current_list in gear_products)
var/category = current_list[2]
for(var/entry in current_list[1])
var/datum/stored_item/vending_product/product = new/datum/stored_item/vending_product(src, entry)
product.price = (entry in prices) ? prices[entry] : 0
product.category = category
gear_product_records.Add(product)
var/list/clothing_products = list(
list(list_clothing, "cat_clothing"))
for(var/current_list in clothing_products)
var/category = current_list[2]
for(var/entry in current_list[1])
var/datum/stored_item/vending_product/product = new/datum/stored_item/vending_product(src, entry)
product.price = (entry in prices) ? prices[entry] : 0
product.category = category
clothing_product_records.Add(product)
var/list/misc_products = list(
list(list_misc, "cat_misc"))
for(var/current_list in misc_products)
var/category = current_list[2]
for(var/entry in current_list[1])
var/datum/stored_item/vending_product/product = new/datum/stored_item/vending_product(src, entry)
product.price = (entry in prices) ? prices[entry] : 0
product.category = category
misc_product_records.Add(product)
var/list/drinks_products = list(
list(list_drinks, "cat_drinks"))
for(var/current_list in drinks_products)
var/category = current_list[2]
for(var/entry in current_list[1])
var/datum/stored_item/vending_product/product = new/datum/stored_item/vending_product(src, entry)
product.price = (entry in prices) ? prices[entry] : 0
product.category = category
drinks_product_records.Add(product)
var/list/pets_products = list(
list(list_pets, "cat_pets"))
for(var/current_list in pets_products)
var/category = current_list[2]
for(var/entry in current_list[1])
var/datum/stored_item/vending_product/product = new/datum/stored_item/vending_product(src, entry)
product.price = (entry in prices) ? prices[entry] : 0
product.category = category
pets_product_records.Add(product)
/obj/machinery/casino_prize_dispenser/Destroy()
for(var/datum/stored_item/vending_product/R in weapons_product_records)
qdel(R)
weapons_product_records = null
for(var/datum/stored_item/vending_product/R in gear_product_records)
qdel(R)
gear_product_records = null
for(var/datum/stored_item/vending_product/R in clothing_product_records)
qdel(R)
clothing_product_records = null
for(var/datum/stored_item/vending_product/R in misc_product_records)
qdel(R)
misc_product_records = null
for(var/datum/stored_item/vending_product/R in drinks_product_records)
qdel(R)
drinks_product_records = null
for(var/datum/stored_item/vending_product/R in pets_product_records)
qdel(R)
pets_product_records = null
return ..()
/obj/machinery/casino_prize_dispenser/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(currently_vending)
var/paid = 0
var/handled = 0
if(istype(W, /obj/item/weapon/spacecasinocash))
var/obj/item/weapon/spacecasinocash/C = W
paid = pay_with_chips(C, user)
handled = 1
if(paid)
vend(currently_vending, usr)
return
else if(handled)
SSnanoui.update_uis(src)
return // don't smack that machine with your 2 chips
if(istype(W, /obj/item/weapon/spacecasinocash))
attack_hand(user)
return
..()
/obj/machinery/casino_prize_dispenser/attack_hand(mob/user as mob)
if(stat & (BROKEN|NOPOWER))
return
ui_interact(user)
/obj/machinery/casino_prize_dispenser/proc/pay_with_chips(var/obj/item/weapon/spacecasinocash/cashmoney, mob/user)
if(currently_vending.price > cashmoney.worth)
// This is not a status display message, since it's something the character
// themselves is meant to see BEFORE putting the money in
to_chat(usr, "\icon[cashmoney] <span class='warning'>That is not enough chips.</span>")
return 0
if(istype(cashmoney, /obj/item/weapon/spacecasinocash))
visible_message("<span class='info'>\The [usr] inserts some chips into \the [src].</span>")
cashmoney.worth -= currently_vending.price
if(cashmoney.worth <= 0)
usr.drop_from_inventory(cashmoney)
qdel(cashmoney)
else
cashmoney.update_icon()
return 1
/obj/machinery/casino_prize_dispenser/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
user.set_machine(src)
var/list/data = list()
if(currently_vending)
data["mode"] = 2
data["product"] = currently_vending.item_name
data["price"] = currently_vending.price
data["message_err"] = 0
data["message"] = status_message
data["message_err"] = status_error
else if(currently_selecting)
data["mode"] = 1
var/list/listed_products = null
listed_products = list()
switch(currently_selecting)
if("cat_weapons")
for(var/key = 1 to weapons_product_records.len)
var/datum/stored_item/vending_product/I = weapons_product_records[key]
listed_products.Add(list(list(
"key" = key,
"name" = I.item_name,
"price" = I.price,
"color" = I.display_color)))
if("cat_gear")
for(var/key = 1 to gear_product_records.len)
var/datum/stored_item/vending_product/I = gear_product_records[key]
listed_products.Add(list(list(
"key" = key,
"name" = I.item_name,
"price" = I.price,
"color" = I.display_color)))
if("cat_clothing")
for(var/key = 1 to clothing_product_records.len)
var/datum/stored_item/vending_product/I = clothing_product_records[key]
listed_products.Add(list(list(
"key" = key,
"name" = I.item_name,
"price" = I.price,
"color" = I.display_color)))
if("cat_misc")
for(var/key = 1 to misc_product_records.len)
var/datum/stored_item/vending_product/I = misc_product_records[key]
listed_products.Add(list(list(
"key" = key,
"name" = I.item_name,
"price" = I.price,
"color" = I.display_color)))
if("cat_drinks")
for(var/key = 1 to drinks_product_records.len)
var/datum/stored_item/vending_product/I = drinks_product_records[key]
listed_products.Add(list(list(
"key" = key,
"name" = I.item_name,
"price" = I.price,
"color" = I.display_color)))
if("cat_pets")
for(var/key = 1 to pets_product_records.len)
var/datum/stored_item/vending_product/I = pets_product_records[key]
listed_products.Add(list(list(
"key" = key,
"name" = I.item_name,
"price" = I.price,
"color" = I.display_color)))
else
return
data["products"] = listed_products
else
data["mode"] = 0
data["category_weapons"] = category_weapons
data["category_gear"] = category_gear
data["category_clothing"] = category_clothing
data["category_misc"] = category_misc
data["category_drinks"] = category_drinks
data["category_pets"] = category_pets
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if(!ui)
ui = new(user, src, ui_key, "casino_prize_dispenser_ch.tmpl", name, 440, 600)
ui.set_initial_data(data)
ui.open()
/obj/machinery/casino_prize_dispenser/Topic(href, href_list)
if(stat & (BROKEN|NOPOWER))
return
if(usr.stat || usr.restrained())
return
if((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf)))) //WIP check the vending_product
if((href_list["Select"]) && (vend_ready) && (!currently_vending))
switch(href_list["Select"])
if("selected_weapons")
currently_selecting = "cat_weapons"
prize_payout_mode = category_weapons
if("selected_gear")
currently_selecting = "cat_gear"
prize_payout_mode = category_gear
if("selected_clothing")
currently_selecting = "cat_clothing"
prize_payout_mode = category_clothing
if("selected_misc")
currently_selecting = "cat_misc"
prize_payout_mode = category_misc
if("selected_drinks")
currently_selecting = "cat_drinks"
prize_payout_mode = category_drinks
if("selected_pets")
currently_selecting = "cat_pets"
prize_payout_mode = category_pets
else
currently_selecting = null
prize_payout_mode = null
if((href_list["vend"]) && (vend_ready) && (!currently_vending))
var/key = text2num(href_list["vend"])
switch(currently_selecting)
if("cat_weapons")
var/datum/stored_item/vending_product/R = weapons_product_records[key]
currently_selecting = null
if(R.price <= 0)
vend(R, usr)
else
currently_vending = R
status_message = "Please insert chips to pay for the prize!"
status_error = 0
if("cat_gear")
var/datum/stored_item/vending_product/R = gear_product_records[key]
currently_selecting = null
if(R.price <= 0)
vend(R, usr)
else
currently_vending = R
status_message = "Please insert chips to pay for the prize!"
status_error = 0
if("cat_clothing")
var/datum/stored_item/vending_product/R = clothing_product_records[key]
currently_selecting = null
if(R.price <= 0)
vend(R, usr)
else
currently_vending = R
status_message = "Please insert chips to pay for the prize!"
status_error = 0
if("cat_misc")
var/datum/stored_item/vending_product/R = misc_product_records[key]
currently_selecting = null
if(R.price <= 0)
vend(R, usr)
else
currently_vending = R
status_message = "Please insert chips to pay for the prize!"
status_error = 0
if("cat_drinks")
var/datum/stored_item/vending_product/R = drinks_product_records[key]
currently_selecting = null
if(R.price <= 0)
vend(R, usr)
else
currently_vending = R
status_message = "Please insert chips to pay for the prize!"
status_error = 0
if("cat_pets")
var/datum/stored_item/vending_product/R = pets_product_records[key]
currently_selecting = null
if(R.price <= 0)
vend(R, usr)
else
currently_vending = R
status_message = "Please insert chips to pay for the prize!"
status_error = 0
else
return
else if(href_list["cancelpurchase"])
currently_vending = null
SSnanoui.update_uis(src)
/obj/machinery/casino_prize_dispenser/proc/vend(datum/stored_item/vending_product/R, mob/user) //WIP
vend_ready = 0 //One thing at a time!!
status_message = "Vending..."
status_error = 0
SSnanoui.update_uis(src)
if(icon_vend) //Show the vending animation if needed
flick(icon_vend,src)
spawn(vend_delay)
if(prize_payout_mode == 2)
new R.item_path(src.loc)
playsound(src, 'sound/items/vending.ogg', 50, 1, 1)
status_message = "Thank you for your purchase, your prize has been logged!"
to_chat(user,status_message)
do_logging(R.item_path, user)
status_message = ""
status_error = 0
vend_ready = 1
currently_vending = null
SSnanoui.update_uis(src)
return 1
/obj/machinery/casino_prize_dispenser/proc/do_logging(item, mob/user)
var/prize_log = "[user.ckey] playing as [user.name] bought a [item]."
log[++log.len] = prize_log
//Currently doesnt have in game way to show, to ensure theres no chance of players ckeys exposed - Jack
@@ -0,0 +1,328 @@
// Use this define to register a prize!
// * n - The proper name of the purchasable
// * o - The object type path of the purchasable to spawn
// * r - The amount to dispense
// * p - The price of the purchasable in chips
// * l - The restriction of the item
#define CASINO_PRIZE(n, o, r, p, l) n = new /datum/data/casino_prize(n, o, r, p, l)
/datum/data/casino_prize
var/equipment_path = null
var/equipment_amt = 1
var/cost = 0
var/category = null
var/restriction = null
/datum/data/casino_prize/New(name, path, amt, cost, restriction)
src.name = name
src.equipment_path = path
src.equipment_amt = amt
src.cost = cost
src.category = category
src.restriction = restriction
/obj/machinery/casino_prize_dispenser
name = "Casino Prize Exchanger"
desc = "Exchange your chips to obtain wonderful prizes! Hoepfully you'll get to keep some of them for a while."
icon = 'icons/obj/casino_ch.dmi'
icon_state ="casino_prize_dispenser"
var/icon_vend ="casino_prize_dispenser-vend"
anchored = 1
density = 1
opacity = 0
var/list/item_list
clicksound = "button"
var/vending_sound = "machines/vending/vending_drop.ogg"
// Power
use_power = USE_POWER_IDLE
idle_power_usage = 10
var/vend_power_usage = 150 //actuators and stuff
// Vending-related
var/datum/data/casino_prize/currently_vending = null // What we're requesting payment for right now
var/list/log = list() //Log only SS13 staff is allowed to look at, CKEYS are listed here for record keeping of prizes and players for events!
var/category_weapons = 1 //For listing categories, if false then prizes of this categories cant be obtained nor bought for post-shift enjoyment
var/category_gear = 1 //If 1 prizes will be only logged
var/category_clothing = 1 //If 2 prizes will both be logged and spawned
var/category_misc = 1
var/category_drinks = 1
var/category_pets = 1
var/category_event = 1 //For special events, holidays, etc
/obj/machinery/casino_prize_dispenser/Initialize()
. = ..()
power_change()
item_list = list()
item_list["Weapons"] = list(
CASINO_PRIZE("Scepter", /obj/item/weapon/scepter, 1, 500, "weapons"),
CASINO_PRIZE("Chain of Command", /obj/item/weapon/melee/chainofcommand, 1, 250, "weapons"),
CASINO_PRIZE("Size Gun", /obj/item/weapon/gun/energy/sizegun, 1, 100, "weapons"),
CASINO_PRIZE("Advanced Particle Rifle", /obj/item/weapon/gun/energy/particle/advanced, 1, 500, "weapons"),
CASINO_PRIZE("Temperature Gun", /obj/item/weapon/gun/energy/temperature, 1, 250, "weapons"),
CASINO_PRIZE("Alien Pistol", /obj/item/weapon/gun/energy/alien, 1, 1000, "weapons"),
CASINO_PRIZE("Floral Gun", /obj/item/weapon/gun/energy/floragun, 1, 250, "weapons"),
CASINO_PRIZE("Net Gun", /obj/item/weapon/gun/energy/netgun, 1, 500, "weapons"),
)
item_list["Gear"] = list(
CASINO_PRIZE("Experimental Welder", /obj/item/weapon/weldingtool/experimental, 1, 500, "gear"),
CASINO_PRIZE("Alien Belt", /obj/item/weapon/storage/belt/utility/alien, 1, 500, "gear"),
CASINO_PRIZE("Alien Armor", /obj/item/clothing/suit/armor/alien, 1, 1000, "gear"),
CASINO_PRIZE("Monocoole", /obj/item/clothing/glasses/monocoole, 1, 1000, "gear"),
CASINO_PRIZE("Chameleon Tie", /obj/item/clothing/accessory/chameleon, 1, 250, "gear"),
CASINO_PRIZE("Chemsprayer", /obj/item/weapon/reagent_containers/spray/chemsprayer, 1, 250, "gear"),
CASINO_PRIZE("Bluespace Beaker", /obj/item/weapon/reagent_containers/glass/beaker/bluespace, 1, 200, "gear"),
CASINO_PRIZE("Cryo Beaker", /obj/item/weapon/reagent_containers/glass/beaker/noreact, 1, 200, "gear"),
)
item_list["Clothing"] = list(
CASINO_PRIZE("Purple cap", /obj/item/clothing/head/soft/purple/wah, 1, 50, "clothing"),
CASINO_PRIZE("Shark mask", /obj/item/clothing/mask/shark, 1, 50, "clothing"),
CASINO_PRIZE("Pig mask", /obj/item/clothing/mask/pig, 1, 50, "clothing"),
CASINO_PRIZE("Luchador mask", /obj/item/clothing/mask/luchador, 1, 50, "clothing"),
CASINO_PRIZE("Horse mask", /obj/item/clothing/mask/horsehead, 1, 50, "clothing"),
CASINO_PRIZE("Goblin mask", /obj/item/clothing/mask/goblin, 1, 50, "clothing"),
CASINO_PRIZE("Fake moustache", /obj/item/clothing/mask/fakemoustache, 1, 50, "clothing"),
CASINO_PRIZE("Dolphin mask", /obj/item/clothing/mask/dolphin, 1, 50, "clothing"),
CASINO_PRIZE("Demon mask", /obj/item/clothing/mask/demon, 1, 50, "clothing"),
CASINO_PRIZE("Chameleon mask", /obj/item/clothing/under/chameleon, 1, 250, "clothing"),
CASINO_PRIZE("Ian costume", /obj/item/clothing/suit/storage/hooded/ian_costume, 1, 50, "clothing"),
CASINO_PRIZE("Carp costume", /obj/item/clothing/suit/storage/hooded/carp_costume, 1, 50, "clothing"),
CASINO_PRIZE("White bunnygirl outfit", /obj/item/weapon/storage/box/casino/costume_whitebunny, 1, 100, "clothing"),
CASINO_PRIZE("Black bunnygirl outfit", /obj/item/weapon/storage/box/casino/costume_blackbunny, 1, 100, "clothing"),
CASINO_PRIZE("Sexy mime costume", /obj/item/weapon/storage/box/casino/costume_sexymime, 1, 100, "clothing"),
CASINO_PRIZE("Sexy clown costume", /obj/item/weapon/storage/box/casino/costume_sexyclown, 1, 100, "clothing"),
CASINO_PRIZE("Catgirl costume", /obj/item/weapon/storage/box/casino/costume_nyangirl, 1, 100, "clothing"),
CASINO_PRIZE("Wizard costume", /obj/item/weapon/storage/box/casino/costume_wizard, 1, 100, "clothing"),
CASINO_PRIZE("Chicken costume", /obj/item/weapon/storage/box/casino/costume_chicken, 1, 100, "clothing"),
CASINO_PRIZE("Gladiator costume", /obj/item/weapon/storage/box/casino/costume_gladiator, 1, 100, "clothing"),
CASINO_PRIZE("Pirate costume", /obj/item/weapon/storage/box/casino/costume_pirate, 1, 100, "clothing"),
CASINO_PRIZE("Commie costume", /obj/item/weapon/storage/box/casino/costume_commie, 1, 100, "clothing"),
CASINO_PRIZE("Imperium monk costume", /obj/item/weapon/storage/box/casino/costume_imperiummonk, 1, 100, "clothing"),
CASINO_PRIZE("Plague doctor costume", /obj/item/weapon/storage/box/casino/costume_plaguedoctor, 1, 100, "clothing"),
CASINO_PRIZE("Witch costume", /obj/item/weapon/storage/box/casino/costume_cutewitch, 1, 100, "clothing"),
)
item_list["Miscellaneous"] = list(
CASINO_PRIZE("Toy sword", /obj/item/toy/sword, 1, 50, "misc"),
CASINO_PRIZE("Waterflower", /obj/item/weapon/reagent_containers/spray/waterflower, 1, 50, "misc"),
CASINO_PRIZE("Horse stick", /obj/item/toy/stickhorse, 1, 50, "misc"),
CASINO_PRIZE("katana", /obj/item/toy/katana, 1, 50, "misc"),
CASINO_PRIZE("Conch", /obj/item/toy/eight_ball/conch, 1, 50, "misc"),
CASINO_PRIZE("Eight ball", /obj/item/toy/eight_ball, 1, 50, "misc"),
CASINO_PRIZE("Foam sword", /obj/item/weapon/material/sword/foam, 1, 50, "misc"),
CASINO_PRIZE("Foam crossbow", /obj/item/weapon/storage/box/casino/foamcrossbow, 1, 50, "misc"),
CASINO_PRIZE("Whistle", /obj/item/toy/bosunwhistle, 1, 50, "misc"),
CASINO_PRIZE("Golden cup", /obj/item/weapon/reagent_containers/food/drinks/golden_cup, 1, 50, "misc"),
CASINO_PRIZE("Quality cigars", /obj/item/weapon/storage/fancy/cigar/havana, 1, 50, "misc"),
CASINO_PRIZE("Casino wallet (kept after event)", /obj/item/weapon/storage/wallet/casino, 1, 50, "misc"),
CASINO_PRIZE("Casino cards", /obj/item/weapon/deck/cards/casino, 1, 50, "misc"),
)
item_list["Drinks"] = list(
CASINO_PRIZE("Redeemer's brew", /obj/item/weapon/reagent_containers/food/drinks/bottle/redeemersbrew, 1, 50, "drinks"),
CASINO_PRIZE("Poison wine", /obj/item/weapon/reagent_containers/food/drinks/bottle/pwine, 1, 50, "drinks"),
CASINO_PRIZE("Patron", /obj/item/weapon/reagent_containers/food/drinks/bottle/patron, 1, 50, "drinks"),
CASINO_PRIZE("Holy water", /obj/item/weapon/reagent_containers/food/drinks/bottle/holywater, 1, 50, "drinks"),
CASINO_PRIZE("Goldschlager", /obj/item/weapon/reagent_containers/food/drinks/bottle/goldschlager, 1, 50, "drinks"),
CASINO_PRIZE("Champagne", /obj/item/weapon/reagent_containers/food/drinks/bottle/champagne, 1, 50, "drinks"),
CASINO_PRIZE("Bottle of Nothing", /obj/item/weapon/reagent_containers/food/drinks/bottle/bottleofnothing, 1, 50, "drinks"),
CASINO_PRIZE("Whiskey bliss", /obj/item/weapon/reagent_containers/food/drinks/bottle/specialwhiskey, 1, 50, "drinks"),
CASINO_PRIZE("Snaps", /obj/item/weapon/reagent_containers/food/drinks/bottle/snaps, 1, 50, "drinks"),
)
item_list["Pets"] = list(
CASINO_PRIZE("Casino Geese", /obj/item/weapon/grenade/spawnergrenade/casino, 1, 200, "pets"),
CASINO_PRIZE("Goat", /obj/item/weapon/grenade/spawnergrenade/casino/goat, 1, 150, "pets"),
CASINO_PRIZE("Armadillo", /obj/item/weapon/grenade/spawnergrenade/casino/armadillo, 1, 150, "pets"),
CASINO_PRIZE("Cat", /obj/item/weapon/grenade/spawnergrenade/casino/cat, 1, 150, "pets"),
CASINO_PRIZE("Chicken", /obj/item/weapon/grenade/spawnergrenade/casino/chicken, 1, 200, "pets"),
CASINO_PRIZE("Cow", /obj/item/weapon/grenade/spawnergrenade/casino/cow, 1, 200, "pets"),
CASINO_PRIZE("Corgi", /obj/item/weapon/grenade/spawnergrenade/casino/corgi, 1, 200, "pets"),
CASINO_PRIZE("Fox", /obj/item/weapon/grenade/spawnergrenade/casino/fox, 1, 150, "pets"),
CASINO_PRIZE("Lizard", /obj/item/weapon/grenade/spawnergrenade/casino/lizard, 1, 150, "pets"),
CASINO_PRIZE("Penguin", /obj/item/weapon/grenade/spawnergrenade/casino/penguin, 1, 150, "pets"),
CASINO_PRIZE("Snake", /obj/item/weapon/grenade/spawnergrenade/casino/snake, 1, 200, "pets"),
CASINO_PRIZE("Yithian", /obj/item/weapon/grenade/spawnergrenade/casino/yithian, 1, 200, "pets"),
CASINO_PRIZE("Tindalos", /obj/item/weapon/grenade/spawnergrenade/casino/tindalos, 1, 200, "pets"),
CASINO_PRIZE("Fennec", /obj/item/weapon/grenade/spawnergrenade/casino/fennec, 1, 300, "pets"),
CASINO_PRIZE("Red panda", /obj/item/weapon/grenade/spawnergrenade/casino/redpanda, 1, 300, "pets"),
CASINO_PRIZE("Horse", /obj/item/weapon/grenade/spawnergrenade/casino/horse, 1, 300, "pets"),
CASINO_PRIZE("Otie", /obj/item/weapon/grenade/spawnergrenade/casino/otie, 1, 500, "pets"),
CASINO_PRIZE("Absolute unit of an Otie", /obj/item/weapon/grenade/spawnergrenade/casino/otie/chubby, 1, 500, "pets"),
CASINO_PRIZE("Zorgoia", /obj/item/weapon/grenade/spawnergrenade/casino/zorgoia, 1, 500, "pets"),
)
item_list["Christmas"] = list(
)
/obj/machinery/casino_prize_dispenser/power_change()
..()
if(stat & BROKEN)
icon_state = "[initial(icon_state)]-broken"
else
if(!(stat & NOPOWER))
icon_state = initial(icon_state)
else
spawn(rand(0, 15))
icon_state = "[initial(icon_state)]-off"
/obj/machinery/casino_prize_dispenser/attack_hand(mob/user as mob)
if(stat & (BROKEN|NOPOWER))
return
tgui_interact(user)
/obj/machinery/casino_prize_dispenser/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(currently_vending)
if(istype(W, /obj/item/weapon/spacecasinocash))
to_chat(usr, "<span class='warning'>Please select prize on display with sufficient amount of chips.</span>")
else
SStgui.update_uis(src)
return // don't smack that machine with your 2 chips
if(istype(W, /obj/item/weapon/spacecasinocash))
attack_hand(user)
return
..()
/obj/machinery/casino_prize_dispenser/proc/pay_with_chips(var/obj/item/weapon/spacecasinocash/cashmoney, mob/user, var/price)
//"cashmoney_:[cashmoney] user:[user] currently_vending:[currently_vending]"
if(price > cashmoney.worth)
to_chat(usr, "\icon[cashmoney] <span class='warning'>That is not enough chips.</span>")
return 0
if(istype(cashmoney, /obj/item/weapon/spacecasinocash))
visible_message("<span class='info'>\The [usr] inserts some chips into \the [src].</span>")
cashmoney.worth -= price
if(cashmoney.worth <= 0)
usr.drop_from_inventory(cashmoney)
qdel(cashmoney)
else
cashmoney.update_icon()
return 1
/obj/machinery/casino_prize_dispenser/ui_assets(mob/user)
return list(
get_asset_datum(/datum/asset/spritesheet/vending),
)
/obj/machinery/casino_prize_dispenser/tgui_data(mob/user)
var/list/data[0]
data["items"] = list()
for(var/cat in item_list)
var/list/cat_items = list()
for(var/prize_name in item_list[cat])
var/datum/data/casino_prize/prize = item_list[cat][prize_name]
cat_items[prize_name] = list("name" = prize_name, "price" = prize.cost, "restriction" = prize.restriction)
data["items"][cat] = cat_items
return data
/obj/machinery/casino_prize_dispenser/tgui_interact(mob/user, datum/tgui/ui = null)
// Open the window
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "CasinoPrizeDispenserCh", name)
ui.open()
/obj/machinery/casino_prize_dispenser/tgui_act(action, params)
if(stat & (BROKEN|NOPOWER))
return
if(usr.stat || usr.restrained())
return
if(..())
return TRUE
. = TRUE
switch(action)
if("purchase")
var/paid = FALSE
var/category = params["cat"]
var/restriction_category = params["restriction"]
var/restriction_check = 0
var/item_given = FALSE
var/name = params["name"]
var/price = params["price"]
var/datum/data/casino_prize/bi = item_list[category][name]
switch(restriction_category)
if("weapons")
restriction_check = category_weapons
if("gear")
restriction_check = category_gear
if("clothing")
restriction_check = category_clothing
if("misc")
restriction_check = category_misc
if("drinks")
restriction_check = category_drinks
if("pets")
restriction_check = category_pets
if("event")
restriction_check = category_event
else
to_chat(usr, "<span class='warning'>Prize checkout error has occured, purchase cancelled.</span>")
return FALSE
if(restriction_check < 1)
to_chat(usr, "<span class='warning'>[name] is restricted, this prize can't be bought.</span>")
return FALSE
if(restriction_check > 1)
item_given = TRUE
if(price <= 0 && item_given == TRUE)
vend(bi, usr)
return TRUE
currently_vending = bi
if(istype(usr.get_active_hand(), /obj/item/weapon/spacecasinocash))
var/obj/item/weapon/spacecasinocash/cash = usr.get_active_hand()
paid = pay_with_chips(cash, usr, price)
else
to_chat(usr, "<span class='warning'>Payment failure: Improper payment method.</span>")
return TRUE // we set this because they shouldn't even be able to get this far, and we want the UI to update.
if(paid)
if(item_given == TRUE)
vend(bi, usr)
speak("Thank you for your purchase, your [bi] has been logged.")
do_logging(currently_vending, usr, bi)
. = TRUE
else
to_chat(usr, "<span class='warning'>Payment failure: unable to process payment.</span>")
/obj/machinery/casino_prize_dispenser/proc/vend(datum/data/casino_prize/bi, mob/user)
SStgui.update_uis(src)
if(ispath(bi.equipment_path, /obj/item/stack))
var/obj/item/stack/S = new bi.equipment_path(loc)
S.amount = bi.equipment_amt
playsound(src, 'sound/machines/vending/vending_drop.ogg', 100, 1)
return TRUE
for(var/i in 1 to bi.equipment_amt)
new bi.equipment_path(loc)
playsound(src, 'sound/machines/vending/vending_drop.ogg', 100, 1)
currently_vending = null
use_power(vend_power_usage) //actuators and stuff
flick("[icon_state]-vend",src)
/obj/machinery/casino_prize_dispenser/proc/do_logging(item, mob/user, datum/data/casino_prize/bi)
var/prize_log = "[user.ckey] playing as [user.name] bought a [item] / [bi.equipment_path]"
log[++log.len] = prize_log
//Currently doesnt have an ingame way to show. Can only be viewed through View-Variables, to ensure theres no chance of players ckeys exposed - Jack
/obj/machinery/casino_prize_dispenser/proc/speak(var/message)
if(stat & NOPOWER)
return
if(!message)
return
for(var/mob/O in hearers(src, null))
O.show_message("<span class='game say'><span class='name'>\The [src]</span> beeps, \"[message]\"</span>",2)
return
/obj/machinery/casino_prize_dispenser/process() //Might not need this, but just to be safe for now
if(stat & (BROKEN|NOPOWER))
return
+12
View File
@@ -34,12 +34,24 @@
/obj/item/clothing/head/crown/goose_king
name = "Crown of the golden goose king"
desc = "It's the crown given to the goose king from the golden goose casino, what an honor!"
icon = 'icons/obj/clothing/hats_ch.dmi'
icon_override = 'icons/mob/head_ch.dmi'
icon_state = "goose_king"
item_state = "goose_king"
/obj/item/clothing/head/crown/goose_king/christmas
name = "Crown of the Goose King of Holiday Spirit"
desc = "It's the crown from the golden goose casino of the Goose King! Given to the one to uphold christmas spirit on Southern Cross, merry christmas!"
/obj/item/clothing/head/crown/goose_queen
name = "Crown of the golden goose queen"
desc = "It's the crown given to the goose queen from the golden goose casino, what an honor!"
icon = 'icons/obj/clothing/hats_ch.dmi'
icon_override = 'icons/mob/head_ch.dmi'
icon_state = "goose_queen"
item_state = "goose_queen"
/obj/item/clothing/head/crown/goose_queen/christmas
name = "Crown of the Goose Queen of Holiday Cheer"
desc = "It's the crown from the golden goose casino of the Goose Queen! Given to the one to spread christmas cheer on Southern Cross, happy holidays!"
@@ -442,7 +442,7 @@
"iz" = (/obj/structure/table/glass,/obj/machinery/button/remote/airlock{id = "casinodorm5"; name = "door lock"; pixel_x = 24; specialfunctions = 4},/turf/simulated/floor/carpet/bcarpet,/area/casino/casino_ship/dorms)
"iA" = (/obj/structure/table/glass,/obj/machinery/button/remote/airlock{id = "casinodorm6"; name = "door lock"; pixel_x = 24; specialfunctions = 4},/turf/simulated/floor/carpet/bcarpet,/area/casino/casino_ship/dorms)
"iB" = (/obj/structure/window/reinforced{dir = 8; health = 1e+006},/obj/structure/flora/tree/palm,/turf/simulated/floor/grass,/area/casino/casino_ship)
"iC" = (/obj/structure/table/marble,/obj/item/device/encryptionkey/talon,/obj/item/device/encryptionkey/talon,/obj/item/device/encryptionkey/talon,/obj/item/device/encryptionkey/talon,/obj/item/device/encryptionkey/talon,/obj/item/device/encryptionkey/talon,/obj/item/device/encryptionkey/talon,/obj/item/device/encryptionkey/talon,/obj/item/clothing/head/crown/goose_king,/obj/item/clothing/head/crown/goose_queen,/turf/simulated/floor/carpet/oracarpet,/area/casino/casino_ship/cockpit)
"iC" = (/obj/structure/table/marble,/obj/item/clothing/head/crown/goose_king,/obj/item/clothing/head/crown/goose_queen,/obj/item/device/radio/headset/syndicate,/obj/item/device/radio/headset/syndicate,/obj/item/device/radio/headset/syndicate,/obj/item/device/radio/headset/syndicate,/obj/item/device/radio/headset/syndicate,/obj/item/device/radio/headset/syndicate,/obj/item/device/radio/headset/syndicate,/obj/item/device/radio/headset/syndicate,/obj/item/device/radio/headset/syndicate,/obj/item/device/radio/headset/syndicate,/turf/simulated/floor/carpet/oracarpet,/area/casino/casino_ship/cockpit)
"iD" = (/obj/structure/table/marble,/obj/item/weapon/card/id/casino,/obj/item/weapon/card/id/casino,/obj/item/weapon/card/id/casino,/obj/item/weapon/card/id/casino,/obj/item/weapon/card/id/casino/booth,/obj/item/weapon/card/id/casino/booth,/turf/simulated/floor/carpet/oracarpet,/area/casino/casino_ship/cockpit)
"iE" = (/obj/item/weapon/book/manual/casino,/obj/structure/table/marble,/obj/machinery/button/remote/airlock{id = "managerdoor"; pixel_x = 8; pixel_y = -2},/obj/item/weapon/card/id/casino/manager,/turf/simulated/floor/carpet/oracarpet,/area/casino/casino_ship/cockpit)
"iF" = (/obj/structure/flora/pottedplant/flower,/turf/simulated/floor/carpet/purcarpet,/area/casino/casino_ship/cockpit)
@@ -497,6 +497,7 @@
"jC" = (/obj/structure/table/rack,/obj/structure/window/reinforced,/obj/structure/window/reinforced{dir = 8},/obj/machinery/door/window/brigdoor/northright{req_access = list(2,160)},/obj/item/weapon/gun/energy/laser,/obj/item/weapon/gun/energy/laser,/obj/item/weapon/gun/energy/laser,/obj/item/weapon/gun/energy/laser,/turf/simulated/floor/tiled,/area/casino/casino_ship/wing_right)
"jD" = (/obj/structure/table/rack,/obj/structure/window/reinforced,/obj/structure/window/reinforced{dir = 4; health = 1e+006},/obj/machinery/door/window/brigdoor/northleft{req_access = list(2,160)},/obj/item/weapon/gun/energy/ionrifle,/obj/item/weapon/gun/energy/ionrifle,/obj/item/weapon/gun/energy/plasmastun,/obj/item/weapon/gun/energy/plasmastun,/obj/item/weapon/gun/energy/gun/burst,/obj/item/weapon/gun/energy/gun/burst,/turf/simulated/floor/tiled,/area/casino/casino_ship/wing_right)
"jE" = (/obj/structure/table/reinforced,/obj/machinery/recharger,/obj/item/weapon/cell/device/weapon,/obj/item/weapon/cell/device/weapon,/obj/item/weapon/cell/device/weapon,/obj/item/weapon/cell/device/weapon,/obj/item/weapon/cell/device/weapon,/obj/item/weapon/cell/device/weapon,/obj/item/weapon/cell/device/weapon,/obj/item/weapon/cell/device/weapon,/turf/simulated/floor/tiled,/area/casino/casino_ship/wing_right)
"jF" = (/obj/machinery/telecomms/allinone/antag,/turf/simulated/floor/tiled,/area/casino/casino_ship/wing_left)
"jJ" = (/obj/structure/table/rack,/obj/structure/window/reinforced,/obj/structure/window/reinforced{dir = 8},/obj/machinery/door/window/brigdoor/northright{req_access = list(2,160)},/obj/item/weapon/gun/projectile/shotgun/pump/combat,/obj/item/weapon/gun/projectile/shotgun/pump/combat,/obj/item/weapon/gun/projectile/garand,/obj/item/weapon/gun/projectile/garand,/obj/item/weapon/gun/projectile/automatic/p90,/obj/item/weapon/gun/projectile/automatic/p90,/turf/simulated/floor/tiled,/area/casino/casino_ship/wing_right)
"jK" = (/obj/structure/table/rack,/obj/structure/window/reinforced,/obj/structure/window/reinforced{dir = 4; health = 1e+006},/obj/machinery/door/window/brigdoor/northleft{req_access = list(2,160)},/obj/item/weapon/storage/box/empshells,/obj/item/weapon/storage/box/shotgunshells/large,/obj/item/weapon/storage/box/shotgunshells/large,/obj/item/weapon/storage/box/shotgunammo/large,/obj/item/weapon/storage/box/shotgunammo/large,/obj/item/ammo_magazine/m762garand,/obj/item/ammo_magazine/m762garand,/obj/item/ammo_magazine/m762garand,/obj/item/ammo_magazine/m762garand,/obj/item/ammo_magazine/m762garand,/obj/item/ammo_magazine/m762garand,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/obj/item/ammo_magazine/m9mmt,/turf/simulated/floor/tiled,/area/casino/casino_ship/wing_right)
@@ -641,7 +642,7 @@ hPaaaaaaaaaaaaaaaaaaaaaaaaaaabababagahaiajakabababababaaaaaaaaaaaaaaaaaaaaaaaaaa
hPaaaaaaaaaaaaaaaaaaaaaaaaaaaqarabasatatatauabatavabababababaaaaaaaaaaacalamamamanacawaxaxaxayaoapapapapaoazazaAaAaAazaAaAaAazaAaAaAazaoapapapapaoapapacadafacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
hPaaaaaaaaaaaaaaaaaaaaaaaaaaaqarabaBaCatatataDatataEaFaGaHababababacacacaIawaxaxayaJaKaLaLaLaMazaAaAaAaAazazazazazazazazazazazazazazazazaAaAaAaAazaAaAaoaNaOaPaQaRaRaRaSaPaQaRaRaRaSaPaQaRaRaRaSaPaQaRaRaRaRaRaRaRaRaRaSacacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
hPaaaaaaaaaaaaaaaaaaaaaaaaaaaqarabababababababatataTatatatababababababacazaKaLaLaMazaKaLaLaLaMazazazazazazazazapapapazazazazazazazazazazazazazazazazazazaUaVaPaWaWaXaYaZaPaWaWaXaYaZaPaWaWaXaYaZaPbabababbbabcbdbebfbfbgacacbhbhaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
hPaaaaaaaaaaaaaaaaaaaaaaaaaaaqarabatatatatatabatatbiatatatabbjbkblbmbnabazboaLaLbpazboaLaLaLbpazapapapapazazazaAaAaAazazazazazazazazazazazazazazazapapazbqbraPbsaWaWaWaWaPbsaWaWaWaWaPbsaWaWaWaWaPbababtbabababubabababaacacbhbhbhbhbhaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
hPaaaaaaaaaaaaaaaaaaaaaaaaaaaqarabjFatatatatabatatbiatatatabbjbkblbmbnabazboaLaLbpazboaLaLaLbpazapapapapazazazaAaAaAazazazazazazazazazazazazazazazapapazbqbraPbsaWaWaWaWaPbsaWaWaWaWaPbsaWaWaWaWaPbababtbabababubabababaacacbhbhbhbhbhaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
hPaaaaaaaaaaaaaaaaaaaaaaaaaaabababbvatatatatabatatbwbxbybzabatatatatbAabazazazazazazazazazazazazaAaAaAaAazazazazazazazazazazazazazazbBazazazazazazaAaAazbCbraPaYaWaWaWaWaPaYaWaWaWaWaPaYaWaWaWaWaPbDbEbababubabababtbabEacbFbGbHbIbJbhbhbhaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
hPaaaaaaaaaaaaaaaaaaaaaaaaaaaqarabatatatatatabbKatatatatatbLatatatatbMabazbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbOazbPbQazbBazbPbQazazazazazazbqaVaPaPaPaPaWaYaPaPaPaPaWaYaPaPaPaPaWaYaPbgbRbSbSbSbababTbUbabaacazbVbVbVbVbhbhbhbhbhaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
hPaaaaaaaaaaaaaaaaaaaaaaaaaaaqarabababababababatatatatatatabbWbXbYatbZabazbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNbNcaazazazazbBazazazazazazazazazaUcbaPcccdaPaWceaPcccdaPaWcfaPcccdaPaWcgaPbbchbSbSbSbacicicjckbdacclcmbVbVcmbhcnbhcnbhbhbhaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -0,0 +1,180 @@
import { createSearch } from 'common/string';
import { Fragment } from 'inferno';
import { useBackend, useLocalState } from "../backend";
import { Box, Button, Collapsible, Dropdown, Flex, Input, NoticeBox, Section } from '../components';
import { Window } from "../layouts";
import { refocusLayout } from '../layouts';
import { logger } from '../logging';
const sortTypes = {
'Alphabetical': (a, b) => a - b,
'By availability': (a, b) => -(a.affordable - b.affordable),
'By price': (a, b) => a.price - b.price,
};
export const CasinoPrizeDispenserCh = (props, context) => {
const { act, data } = useBackend(context);
return (
<Window width={400} height={450} resizable>
<Window.Content className="Layout__content--flexColumn" scrollable>
<Fragment>
<CasinoPrizeDispenserChSearch />
<CasinoPrizeDispenserChItems />
</Fragment>
</Window.Content>
</Window>
);
};
const CasinoPrizeDispenserChItems = (props, context) => {
const { act, data } = useBackend(context);
const {
points,
items,
} = data;
// Search thingies
const [
searchText,
_setSearchText,
] = useLocalState(context, 'search', '');
const [
sortOrder,
_setSortOrder,
] = useLocalState(context, 'sort', 'Alphabetical');
const [
descending,
_setDescending,
] = useLocalState(context, 'descending', false);
const searcher = createSearch(searchText, item => {
return item[0];
});
let has_contents = false;
let contents = Object.entries(items).map((kv, _i) => {
let items_in_cat = Object.entries(kv[1])
.filter(searcher)
.map(kv2 => {
kv2[1].affordable = points >= (kv2[1].price);
return kv2[1];
})
.sort(sortTypes[sortOrder]);
if (items_in_cat.length === 0) {
return;
}
if (descending) {
items_in_cat = items_in_cat.reverse();
}
has_contents = true;
return (
<CasinoPrizeDispenserChItemsCategory
key={kv[0]}
title={kv[0]}
items={items_in_cat}
/>
);
});
return (
<Flex.Item grow="1" overflow="auto">
<Section onClick={e => refocusLayout()}>
{has_contents
? contents : (
<Box color="label">
No items matching your criteria was found!
</Box>
)}
</Section>
</Flex.Item>
);
};
const CasinoPrizeDispenserChSearch = (props, context) => {
const [
_searchText,
setSearchText,
] = useLocalState(context, 'search', '');
const [
_sortOrder,
setSortOrder,
] = useLocalState(context, 'sort', '');
const [
descending,
setDescending,
] = useLocalState(context, 'descending', false);
return (
<Box mb="0.5rem">
<Flex width="100%">
<Flex.Item grow="1" mr="0.5rem">
<Input
placeholder="Search by item name.."
width="100%"
onInput={(_e, value) => setSearchText(value)}
/>
</Flex.Item>
<Flex.Item basis="30%">
<Dropdown
selected="Alphabetical"
options={Object.keys(sortTypes)}
width="100%"
lineHeight="19px"
onSelected={v => setSortOrder(v)} />
</Flex.Item>
<Flex.Item>
<Button
icon={descending ? "arrow-down" : "arrow-up"}
height="19px"
tooltip={descending ? "Descending order" : "Ascending order"}
tooltipPosition="bottom-left"
ml="0.5rem"
onClick={() => setDescending(!descending)}
/>
</Flex.Item>
</Flex>
</Box>
);
};
const CasinoPrizeDispenserChItemsCategory = (properties, context) => {
const { act, data } = useBackend(context);
const {
title,
items,
...rest
} = properties;
return (
<Collapsible open title={title} {...rest}>
{items.map(item => (
<Box key={item.name}>
<Box
display="inline-block"
verticalAlign="middle"
lineHeight="20px"
style={{
float: 'left',
}}>
{item.name}
</Box>
<Button
content={(item.price).toLocaleString('en-US')}
width="15%"
textAlign="center"
style={{
float: 'right',
}}
onClick={() => act('purchase', {
cat: title,
name: item.name,
price: item.price,
restriction: item.restriction,
})}
/>
<Box
style={{
clear: "both",
}}
/>
</Box>
))}
</Collapsible>
);
};
File diff suppressed because one or more lines are too long
+1
View File
@@ -806,6 +806,7 @@
#include "code\game\machinery\buttons_vr.dm"
#include "code\game\machinery\CableLayer.dm"
#include "code\game\machinery\casino_ch.dm"
#include "code\game\machinery\casino_prize_dispenser_ch.dm"
#include "code\game\machinery\cell_charger.dm"
#include "code\game\machinery\cloning.dm"
#include "code\game\machinery\cryo.dm"