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

[MIRROR] Rework fortune cookies #2979

Merged
merged 1 commit into from
Jan 6, 2025
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2962,6 +2962,7 @@
#include "code\modules\reagents\reagent_containers\food\snacks\bugmeat.dm"
#include "code\modules\reagents\reagent_containers\food\snacks\cheese.dm"
#include "code\modules\reagents\reagent_containers\food\snacks\donkpocket.dm"
#include "code\modules\reagents\reagent_containers\food\snacks\fortunecookie.dm"
#include "code\modules\reagents\reagent_containers\food\snacks\meat.dm"
#include "code\modules\reagents\reagent_containers\food\snacks\shellfish.dm"
#include "code\modules\reagents\reagent_containers\glass\bottle.dm"
Expand Down
7 changes: 5 additions & 2 deletions code/datums/recipe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@
var/antag_text


/datum/microwave_recipe/proc/CreateResult(obj/machinery/microwave/microwave)
var/atom/movable/result = new result_path (microwave)
/datum/microwave_recipe/proc/CreateResult(obj/machinery/microwave/microwave, ...)
var/list/result_args = list(microwave)
if (length(args) > 1)
result_args += args.Copy(2)
var/atom/movable/result = new result_path (arglist(result_args))
microwave.reagents.clear_reagents()
if (!length(microwave.ingredients))
return result
Expand Down
8 changes: 2 additions & 6 deletions code/datums/trading/food.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,8 @@
/datum/trader/ship/chinese/trade_quantity(quantity, list/offers, num, turf/location)
. = ..()
quantity = 1
if(.)
var/obj/item/reagent_containers/food/snacks/fortunecookie/cookie = new(location)
var/obj/item/paper/paper = new(cookie)
cookie.trash = paper
paper.SetName("Fortune")
paper.info = pick(fortunes)
if (.)
new /obj/item/reagent_containers/food/snacks/fortunecookie (location)

/datum/trader/grocery
name = "Grocer"
Expand Down
26 changes: 8 additions & 18 deletions code/modules/food/recipes_microwave.dm
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
result_path = /obj/item/reagent_containers/food/snacks/donkpocket


/datum/microwave_recipe/hot_donkpocket/CreateResult(obj/machinery/microwave/microwave)
/datum/microwave_recipe/hot_donkpocket/CreateResult(obj/machinery/microwave/microwave, ...)
var/obj/item/reagent_containers/food/snacks/donkpocket/donk = locate() in microwave
donk?.SetHot()
return donk
Expand Down Expand Up @@ -469,22 +469,12 @@
result_path = /obj/item/reagent_containers/food/snacks/fortunecookie


/datum/microwave_recipe/fortunecookie/CreateResult(obj/machinery/microwave/microwave)
var/obj/item/reagent_containers/food/snacks/fortunecookie/cookie = ..()
/datum/microwave_recipe/fortunecookie/CreateResult(obj/machinery/microwave/microwave, ...)
var/obj/item/paper/paper = locate() in microwave
if (paper)
paper.forceMove(cookie)
cookie.trash = paper
paper.loc = null
return cookie


/datum/microwave_recipe/fortunecookie/CheckItems(obj/machinery/microwave/microwave)
. = ..()
if (.)
var/obj/item/paper/paper = locate() in microwave
if (!paper?.info)
return FALSE
if (paper.info)
microwave.ingredients -= paper
return ..(microwave, paper)
return ..(microwave)


/datum/microwave_recipe/plainsteak
Expand Down Expand Up @@ -616,7 +606,7 @@
result_path = /obj/item/reagent_containers/food/snacks/amanitajelly


/datum/microwave_recipe/amanitajelly/CreateResult(obj/machinery/microwave/microwave)
/datum/microwave_recipe/amanitajelly/CreateResult(obj/machinery/microwave/microwave, ...)
var/obj/item/reagent_containers/food/snacks/amanitajelly/jelly = ..()
jelly.reagents.del_reagent(/datum/reagent/toxin/amatoxin)
return jelly
Expand Down Expand Up @@ -1349,7 +1339,7 @@
result_path = /obj/item/reagent_containers/food/snacks/validsalad


/datum/microwave_recipe/validsalad/CreateResult(obj/machinery/microwave/microwave)
/datum/microwave_recipe/validsalad/CreateResult(obj/machinery/microwave/microwave, ...)
var/obj/item/reagent_containers/food/snacks/validsalad/salad = ..()
salad.reagents.del_reagent(/datum/reagent/toxin)
return salad
Expand Down
10 changes: 0 additions & 10 deletions code/modules/reagents/reagent_containers/food/snacks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1052,16 +1052,6 @@
.=..()
reagents.add_reagent(/datum/reagent/nutriment/protein, 2)

/obj/item/reagent_containers/food/snacks/fortunecookie
name = "fortune cookie"
desc = "A true prophecy in each cookie!"
icon_state = "fortune_cookie"
filling_color = "#e8e79e"
center_of_mass = "x=15;y=14"
nutriment_desc = list("fortune cookie" = 2)
nutriment_amt = 3
bitesize = 2

/obj/item/reagent_containers/food/snacks/badrecipe
name = "burned mess"
desc = "Someone should be demoted from chef for this."
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
GLOBAL_LIST_INIT(fortune_cookie_default_fortunes, list(
"Today it's up to you to create the peacefulness you long for.",
"If you refuse to accept anything but the best, you very often get it.",
"A smile is your passport into the hearts of others.",
"Hard work pays off in the future, laziness pays off now.",
"Change can hurt, but it leads a path to something better.",
"Hidden in a valley beside an open stream- This will be the type of place where you will find your dream.",
"Never give up. You're not a failure if you don't give up.",
"Love can last a lifetime, if you want it to.",
"The love of your life is stepping into your planet this summer.",
"Your ability for accomplishment will follow with success.",
"Please help me, I'm trapped in a fortune cookie factory!"
))


/obj/item/reagent_containers/food/snacks/fortunecookie
name = "fortune cookie"
desc = "A true prophecy in each cookie!"
icon_state = "fortune_cookie"
filling_color = "#e8e79e"
center_of_mass = "x=15;y=14"
nutriment_desc = list("fortune cookie" = 2)
nutriment_amt = 3
bitesize = 2

/// The paper fortune contained inside the cookie. Set during `Initialize()`.
var/obj/item/paper/fortune

/// Boolean. Whether or not the cookie has already been broken open,
var/opened = FALSE


/obj/item/reagent_containers/food/snacks/fortunecookie/Initialize(mapload, obj/item/paper/fortune)
. = ..()
if (. == INITIALIZE_HINT_QDEL)
return
if (!fortune)
fortune = new (src)
fortune.set_content(pick(GLOB.fortune_cookie_default_fortunes), "fortune", FALSE)
set_fortune(fortune)


/obj/item/reagent_containers/food/snacks/fortunecookie/Destroy()
QDEL_NULL(fortune)
return ..()


/obj/item/reagent_containers/food/snacks/fortunecookie/examine(mob/user, distance)
. = ..()
if (opened)
to_chat(user, SPAN_WARNING("It's been broken open and no longer holds a fortune."))


/obj/item/reagent_containers/food/snacks/fortunecookie/attack_self(mob/user)
if (opened)
USE_FEEDBACK_FAILURE("\The [src] has already been broken open.")
return TRUE
var/message = "but it was empty"
if (fortune)
message = "revealing \a [fortune]"
fortune.forceMove(user.loc)
user.put_in_hands(fortune)
fortune = null
user.visible_message(
SPAN_NOTICE("\The [user] cracks open \a [src], [message]."),
SPAN_NOTICE("You crack open \the [src], [message].")
)
SetName("open [name]")
opened = TRUE


/obj/item/reagent_containers/food/snacks/fortunecookie/proc/set_fortune(obj/item/paper/new_fortune)
if (new_fortune == fortune)
return
if (fortune)
fortune.dropInto(loc)
if (new_fortune)
new_fortune.forceMove(src)
fortune = new_fortune
Loading