Merge pull request #8875 from Citinited/put-that-cookie-down

Adds random fortunes to fortune cookies
This commit is contained in:
Fox McCloud
2018-07-11 13:55:28 -04:00
committed by GitHub
6 changed files with 84 additions and 14 deletions
@@ -1070,6 +1070,7 @@
icon_state = "fortune_cookie"
filling_color = "#E8E79E"
list_reagents = list("nutriment" = 3)
trash = /obj/item/paper/fortune
/obj/item/reagent_containers/food/snacks/badrecipe
name = "Burned mess"
@@ -180,21 +180,16 @@
result = /obj/item/reagent_containers/food/snacks/fortunecookie
/datum/recipe/oven/fortunecookie/make_food(obj/container)
var/obj/item/paper/paper = locate() in container
paper.loc = null //prevent deletion
var/obj/item/paper/P = locate() in container
P.loc = null //So we don't delete the paper while cooking the cookie
var/obj/item/reagent_containers/food/snacks/fortunecookie/being_cooked = ..()
paper.loc = being_cooked
being_cooked.trash = paper //so the paper is left behind as trash without special-snowflake(TM Nodrak) code ~carn
if(P.info) //If there's anything written on the paper, just move it into the fortune cookie
P.forceMove(being_cooked) //Prevents the oven deleting our paper
being_cooked.trash = P //so the paper is left behind as trash without special-snowflake(TM Nodrak) code ~carn
else
qdel(P)
return being_cooked
/datum/recipe/oven/fortunecookie/check_items(obj/container)
. = ..()
if(.)
var/obj/item/paper/paper = locate() in container
if(!paper || !paper.info)
return -1
return .
/datum/recipe/oven/pizzamargherita
items = list(
/obj/item/reagent_containers/food/snacks/sliceable/flatdough,
+18 -2
View File
@@ -34,6 +34,8 @@
var/contact_poison // Reagent ID to transfer on contact
var/contact_poison_volume = 0
var/contact_poison_poisoner = null
var/paper_width = 400//Width of the window that opens
var/paper_height = 400//Height of the window that opens
var/const/deffont = "Verdana"
var/const/signfont = "Times New Roman"
@@ -72,12 +74,12 @@
if((!user.say_understands(null, all_languages["Galactic Common"]) && !forceshow) || forcestars) //assuming all paper is written in common is better than hardcoded type checks
data = "<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[stars(info)][stamps]</BODY></HTML>"
if(view)
usr << browse(data, "window=[name]")
usr << browse(data, "window=[name];size=[paper_width]x[paper_height]")
onclose(usr, "[name]")
else
data = "<HTML><HEAD><TITLE>[name]</TITLE></HEAD><BODY>[infolinks ? info_links : info][stamps]</BODY></HTML>"
if(view)
usr << browse(data, "window=[name]")
usr << browse(data, "window=[name];size=[paper_width]x[paper_height]")
onclose(usr, "[name]")
return data
@@ -476,6 +478,20 @@
/obj/item/paper/crumpled/bloody
icon_state = "scrap_bloodied"
/obj/item/paper/fortune
name = "fortune"
icon_state = "slip"
paper_height = 150
/obj/item/paper/fortune/New()
..()
var/fortunemessage = pick(GLOB.fortune_cookie_messages)
info = "<p style='text-align:center;font-family:[deffont];font-size:120%;font-weight:bold;'>[fortunemessage]</p>"
info += "<p style='text-align:center;'><strong>Lucky numbers</strong>: [rand(1,49)], [rand(1,49)], [rand(1,49)], [rand(1,49)], [rand(1,49)]</p>"
/obj/item/paper/fortune/update_icon()
..()
icon_state = initial(icon_state)
/*
* Premade paper
*/