mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-27 14:07:51 +01:00
Refactoring and rewording
Moves recipe list generation into its own proc and out of New() - Makes lists only generate/update if not present, to save a small bit of processing on the loop Rewords the messages when adding items to mixing bowls and kitchen machines to sound slightly better > Also refactored messages which were split between multiple lines in the code to be on one line and removed an extra space in one message
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
if(S.amount > 1)
|
||||
new S.type (src)
|
||||
S.use(1)
|
||||
user.visible_message("<span class='notice'>[user] has added one of [S] to [src].</span>", "<span class='notice'>You add one of [S] to [src].</span>")
|
||||
user.visible_message("<span class='notice'>[user] adds one of [S] to [src].</span>", "<span class='notice'>You add one of [S] to [src].</span>")
|
||||
else
|
||||
return add_item(S, user)
|
||||
else
|
||||
@@ -56,7 +56,7 @@
|
||||
//return 0
|
||||
else
|
||||
I.forceMove(src)
|
||||
user.visible_message("<span class='notice'>[user] has added [I] to [src].</span>", "<span class='notice'>You add [I] to [src].</span>")
|
||||
user.visible_message("<span class='notice'>[user] adds [I] to [src].</span>", "<span class='notice'>You add [I] to [src].</span>")
|
||||
|
||||
/obj/item/mixing_bowl/attack_self(mob/user)
|
||||
var/dat = ""
|
||||
|
||||
@@ -32,24 +32,28 @@
|
||||
..()
|
||||
create_reagents(100)
|
||||
reagents.set_reacting(FALSE)
|
||||
init_lists()
|
||||
|
||||
/obj/machinery/kitchen_machine/proc/init_lists()
|
||||
if(!GLOB.cooking_recipes[recipe_type])
|
||||
GLOB.cooking_recipes[recipe_type] = list()
|
||||
GLOB.cooking_ingredients[recipe_type] = list()
|
||||
GLOB.cooking_reagents[recipe_type] = list()
|
||||
for(var/type in subtypesof(GLOB.cooking_recipe_types[recipe_type]))
|
||||
var/datum/recipe/recipe = new type
|
||||
if(recipe in GLOB.cooking_recipes[recipe_type])
|
||||
qdel(recipe)
|
||||
continue
|
||||
if(recipe.result) // Ignore recipe subtypes that lack a result
|
||||
GLOB.cooking_recipes[recipe_type] += recipe
|
||||
for(var/item in recipe.items)
|
||||
GLOB.cooking_ingredients[recipe_type] |= item
|
||||
for(var/reagent in recipe.reagents)
|
||||
GLOB.cooking_reagents[recipe_type] |= reagent
|
||||
else
|
||||
qdel(recipe)
|
||||
GLOB.cooking_ingredients[recipe_type] |= /obj/item/reagent_containers/food/snacks/grown
|
||||
if(!length(GLOB.cooking_recipes[recipe_type]))
|
||||
for(var/type in subtypesof(GLOB.cooking_recipe_types[recipe_type]))
|
||||
var/datum/recipe/recipe = new type
|
||||
if(recipe in GLOB.cooking_recipes[recipe_type])
|
||||
qdel(recipe)
|
||||
continue
|
||||
if(recipe.result) // Ignore recipe subtypes that lack a result
|
||||
GLOB.cooking_recipes[recipe_type] += recipe
|
||||
for(var/item in recipe.items)
|
||||
GLOB.cooking_ingredients[recipe_type] |= item
|
||||
for(var/reagent in recipe.reagents)
|
||||
GLOB.cooking_reagents[recipe_type] |= reagent
|
||||
else
|
||||
qdel(recipe)
|
||||
GLOB.cooking_ingredients[recipe_type] |= /obj/item/reagent_containers/food/snacks/grown
|
||||
|
||||
/*******************
|
||||
* Item Adding
|
||||
@@ -78,26 +82,14 @@
|
||||
|
||||
if(broken > 0)
|
||||
if(broken == 2 && istype(O, /obj/item/screwdriver)) // If it's broken and they're using a screwdriver
|
||||
user.visible_message( \
|
||||
"<span class='notice'>[user] starts to fix part of \the [src].</span>", \
|
||||
"<span class='notice'>You start to fix part of \the [src].</span>" \
|
||||
)
|
||||
user.visible_message("<span class='notice'>[user] starts to fix part of [src].</span>", "<span class='notice'>You start to fix part of [src].</span>")
|
||||
if(do_after(user, 20 * O.toolspeed, target = src))
|
||||
user.visible_message( \
|
||||
"<span class='notice'>[user] fixes part of \the [src].</span>", \
|
||||
"<span class='notice'>You have fixed part of \the [src].</span>" \
|
||||
)
|
||||
user.visible_message("<span class='notice'>[user] fixes part of [src].</span>", "<span class='notice'>You have fixed part of \the [src].</span>")
|
||||
broken = 1 // Fix it a bit
|
||||
else if(broken == 1 && istype(O, /obj/item/wrench)) // If it's broken and they're doing the wrench
|
||||
user.visible_message( \
|
||||
"<span class='notice'>[user] starts to fix part of \the [src].</span>", \
|
||||
"<span class='notice'>You start to fix part of \the [src].</span>" \
|
||||
)
|
||||
user.visible_message("<span class='notice'>[user] starts to fix part of [src].</span>", "<span class='notice'>You start to fix part of [src].</span>")
|
||||
if(do_after(user, 20 * O.toolspeed, target = src))
|
||||
user.visible_message( \
|
||||
"<span class='notice'>[user] fixes \the [src].</span>", \
|
||||
"<span class='notice'>You have fixed \the [src].</span>" \
|
||||
)
|
||||
user.visible_message("<span class='notice'>[user] fixes [src].</span>", "<span class='notice'>You have fixed [src].</span>")
|
||||
icon_state = off_icon
|
||||
broken = 0 // Fix it!
|
||||
dirty = 0 // just to be sure
|
||||
@@ -107,15 +99,9 @@
|
||||
return 1
|
||||
else if(dirty==100) // The machine is all dirty so can't be used!
|
||||
if(istype(O, /obj/item/reagent_containers/spray/cleaner) || istype(O, /obj/item/soap)) // If they're trying to clean it then let them
|
||||
user.visible_message( \
|
||||
"<span class='notice'>[user] starts to clean \the [src].</span>", \
|
||||
"<span class='notice'>You start to clean \the [src].</span>" \
|
||||
)
|
||||
user.visible_message("<span class='notice'>[user] starts to clean [src].</span>", "<span class='notice'>You start to clean [src].</span>")
|
||||
if(do_after(user, 20 * O.toolspeed, target = src))
|
||||
user.visible_message( \
|
||||
"<span class='notice'>[user] has cleaned [src].</span>", \
|
||||
"<span class='notice'>You have cleaned [src].</span>" \
|
||||
)
|
||||
user.visible_message("<span class='notice'>[user] has cleaned [src].</span>", "<span class='notice'>You have cleaned [src].</span>")
|
||||
dirty = 0 // It's clean!
|
||||
broken = 0 // just to be sure
|
||||
icon_state = off_icon
|
||||
@@ -132,7 +118,7 @@
|
||||
if(S.amount > 1)
|
||||
new S.type (src)
|
||||
S.use(1)
|
||||
user.visible_message("<span class='notice'>[user] has added one of [S] to [src].</span>", "<span class='notice'>You add one of [S] to [src].</span>")
|
||||
user.visible_message("<span class='notice'>[user] adds one of [S] to [src].</span>", "<span class='notice'>You add one of [S] to [src].</span>")
|
||||
else
|
||||
add_item(S, user)
|
||||
else
|
||||
@@ -158,7 +144,7 @@
|
||||
//return 0
|
||||
else
|
||||
I.forceMove(src)
|
||||
user.visible_message("<span class='notice'>[user] has added [I] to [src].</span>", "<span class='notice'>You add [I] to [src].</span>")
|
||||
user.visible_message("<span class='notice'>[user] adds [I] to [src].</span>", "<span class='notice'>You add [I] to [src].</span>")
|
||||
|
||||
/obj/machinery/kitchen_machine/attack_ai(mob/user)
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user