mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-09 16:14:13 +00:00
Adds canned bread (#29654)
* Adds canned bread * Critical immulsions error * Readds icon * put in hands Co-authored-by: Kurfursten <scouttac@gmail.com>
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
/datum/storeitem/menu1,
|
||||
/datum/storeitem/menu2,
|
||||
/datum/storeitem/diy_soda,
|
||||
/datum/storeitem/canned_bread,
|
||||
),
|
||||
"ZAM!" = list(
|
||||
/datum/storeitem/zambiscuits,
|
||||
@@ -82,7 +83,7 @@
|
||||
|
||||
refresh_ui()
|
||||
|
||||
/obj/machinery/computer/merch/proc/refresh_ui()
|
||||
/obj/machinery/computer/merch/proc/refresh_ui(var/mob/user)
|
||||
|
||||
var/dat = {"<tbody id="StoreTable">"}
|
||||
|
||||
@@ -93,7 +94,7 @@
|
||||
<th><h2>[category_name]</h2></th>
|
||||
"}
|
||||
for(var/store_item in category_items)
|
||||
dat += make_div(store_item)
|
||||
dat += make_div(store_item, user)
|
||||
|
||||
dat += "</table>"
|
||||
|
||||
@@ -121,10 +122,12 @@
|
||||
src.add_hiddenprint(user)
|
||||
return attack_hand(user)
|
||||
|
||||
/obj/machinery/computer/merch/proc/make_div(var/store_ID)
|
||||
/obj/machinery/computer/merch/proc/make_div(var/store_ID, var/mob/user)
|
||||
var/datum/storeitem/SI = centcomm_store.items["[store_ID]"]
|
||||
if(SI.stock == 0)
|
||||
return "<tr><td><i>[SI.name] (SOLD OUT)</i></td></tr>"
|
||||
else if(user && !SI.available_to_user(user))
|
||||
return
|
||||
else
|
||||
. = "<tr><td><A href='?src=\ref[src];choice=buy;chosen_item=[store_ID]'>[SI.name] ([!(SI.cost) ? "free" : "[SI.cost]$"])"
|
||||
if(SI.stock != -1)
|
||||
@@ -139,7 +142,7 @@
|
||||
interface.hide(user)
|
||||
return
|
||||
|
||||
refresh_ui()
|
||||
refresh_ui(user)
|
||||
interact(user)
|
||||
|
||||
/obj/machinery/computer/merch/interact(mob/user)
|
||||
@@ -164,7 +167,7 @@
|
||||
else
|
||||
to_chat(usr, "[bicon(src)]<span class='notice'>Transaction complete! Enjoy your product.</span>")
|
||||
|
||||
src.refresh_ui()
|
||||
src.refresh_ui(usr)
|
||||
return
|
||||
|
||||
/obj/machinery/computer/merch/update_icon()
|
||||
|
||||
@@ -218,16 +218,17 @@
|
||||
/obj/item/weapon/reagent_containers/food/drinks/examine(mob/user)
|
||||
..()
|
||||
|
||||
if(!reagents || reagents.total_volume == 0)
|
||||
to_chat(user, "<span class='info'>\The [src] is empty!</span>")
|
||||
else if (reagents.total_volume <= src.volume/4)
|
||||
to_chat(user, "<span class='info'>\The [src] is almost empty!</span>")
|
||||
else if (reagents.total_volume <= src.volume*0.66)
|
||||
to_chat(user, "<span class='info'>\The [src] is about half full, or about half empty!</span>")
|
||||
else if (reagents.total_volume <= src.volume*0.90)
|
||||
to_chat(user, "<span class='info'>\The [src] is almost full!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='info'>\The [src] is full!</span>")
|
||||
if(is_open_container())
|
||||
if(!reagents || reagents.total_volume == 0)
|
||||
to_chat(user, "<span class='info'>\The [src] is empty!</span>")
|
||||
else if (reagents.total_volume <= src.volume/4)
|
||||
to_chat(user, "<span class='info'>\The [src] is almost empty!</span>")
|
||||
else if (reagents.total_volume <= src.volume*0.66)
|
||||
to_chat(user, "<span class='info'>\The [src] is about half full, or about half empty!</span>")
|
||||
else if (reagents.total_volume <= src.volume*0.90)
|
||||
to_chat(user, "<span class='info'>\The [src] is almost full!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='info'>\The [src] is full!</span>")
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/drinks/imbibe(mob/user) //Drink the liquid within
|
||||
if(lit)
|
||||
@@ -673,14 +674,11 @@
|
||||
//because playsound(user, 'sound/effects/can_open[rand(1,3)].ogg', 50, 1) just wouldn't work. also so badmins can varedit these
|
||||
var/list/open_sounds = list('sound/effects/can_open1.ogg', 'sound/effects/can_open2.ogg', 'sound/effects/can_open3.ogg')
|
||||
|
||||
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/drinks/soda_cans/attack_self(var/mob/user)
|
||||
if(!is_open_container())
|
||||
to_chat(user, "You pull back the tab of \the [src] with a satisfying pop.")
|
||||
flags |= OPENCONTAINER
|
||||
src.verbs |= /obj/item/weapon/reagent_containers/verb/empty_contents
|
||||
playsound(user, pick(open_sounds), 50, 1)
|
||||
overlays += image(icon = icon, icon_state = "soda_open")
|
||||
return
|
||||
return pop_open(user)
|
||||
if (reagents.total_volume > 0)
|
||||
return ..()
|
||||
else if (user.a_intent == I_HURT)
|
||||
@@ -692,6 +690,13 @@
|
||||
playsound(user, 'sound/items/can_crushed.ogg', 75, 1)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/drinks/soda_cans/proc/pop_open(var/mob/user)
|
||||
to_chat(user, "You pull back the tab of \the [src] with a satisfying pop.")
|
||||
flags |= OPENCONTAINER
|
||||
src.verbs |= /obj/item/weapon/reagent_containers/verb/empty_contents
|
||||
playsound(user, pick(open_sounds), 50, 1)
|
||||
overlays += image(icon = icon, icon_state = "soda_open")
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/drinks/soda_cans/cola
|
||||
name = "Space Cola"
|
||||
desc = "Cola. in space."
|
||||
@@ -839,6 +844,19 @@
|
||||
reagents.add_reagent(URANIUM, 3.6)
|
||||
reagents.add_reagent(SPORTDRINK, 20)
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/drinks/soda_cans/canned_bread
|
||||
name = "\improper canned bread"
|
||||
desc = "Wow, they have it!"
|
||||
icon_state = "cannedbread"
|
||||
//no actual chemicals in the can
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/drinks/soda_cans/canned_bread/pop_open(var/mob/user)
|
||||
. = ..()
|
||||
spawn(0.5 SECONDS)
|
||||
playsound(src, pick('sound/effects/splat_pie1.ogg','sound/effects/splat_pie2.ogg'), 50)
|
||||
var/obj/B = new /obj/item/weapon/reagent_containers/food/snacks/sliceable/bread(get_turf(src))
|
||||
user.put_in_hands(B)
|
||||
|
||||
/obj/item/weapon/reagent_containers/food/drinks/coloring
|
||||
name = "\improper vial of food coloring"
|
||||
icon = 'icons/obj/chemical.dmi'
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
else
|
||||
new typepath(merchcomp.loc)
|
||||
|
||||
//If this returns FALSE, then the button simply will not appear for the user in question.
|
||||
/datum/storeitem/proc/available_to_user(var/mob/user,var/obj/machinery/computer/merch/merchcomp)
|
||||
return TRUE
|
||||
|
||||
/////////////////////////////
|
||||
// Food
|
||||
@@ -44,6 +47,14 @@
|
||||
typepath = /obj/item/weapon/storage/box/diy_soda
|
||||
cost = 45
|
||||
|
||||
/datum/storeitem/canned_bread
|
||||
name = "Canned Bread"
|
||||
desc = "Best thing since sliced."
|
||||
typepath = /obj/item/weapon/reagent_containers/food/drinks/soda_cans/canned_bread
|
||||
cost = 15
|
||||
/datum/storeitem/canned_bread/available_to_user(var/mob/user,var/obj/machinery/computer/merch/merchcomp)
|
||||
return(isskrell(user) || Holiday == APRIL_FOOLS_DAY)
|
||||
|
||||
/////////////////////////////
|
||||
// Tools
|
||||
/////////////////////////////
|
||||
|
||||
@@ -50,17 +50,20 @@ var/global/datum/store/centcomm_store=new
|
||||
linked_db = DB
|
||||
break
|
||||
|
||||
/datum/store/proc/PlaceOrder(var/mob/living/usr, var/itemID, var/obj/machinery/computer/merch/merchcomp)
|
||||
/datum/store/proc/PlaceOrder(var/mob/living/user, var/itemID, var/obj/machinery/computer/merch/merchcomp)
|
||||
// Get our item, first.
|
||||
var/datum/storeitem/item = items["[itemID]"]
|
||||
if(item.stock == 0)
|
||||
to_chat(usr, "<span class='warning'>That item is sold out.</span>")
|
||||
to_chat(user, "<span class='warning'>That item is sold out.</span>")
|
||||
return
|
||||
if(!item.available_to_user(user, merchcomp))
|
||||
to_chat(user, "<span class='warning'>That item is not available to you.</span>")
|
||||
return
|
||||
// Try to deduct funds.
|
||||
if(!charge(usr,item.cost,item,merchcomp))
|
||||
if(!charge(user,item.cost,item,merchcomp))
|
||||
return 0
|
||||
// Give them the item.
|
||||
item.deliver(usr,merchcomp)
|
||||
item.deliver(user,merchcomp)
|
||||
if(item.stock != -1)
|
||||
item.stock--
|
||||
return 1
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 109 KiB |
Reference in New Issue
Block a user