Skip to content

Commit

Permalink
processing cleanup(Desc)
Browse files Browse the repository at this point in the history
makes processing use the correct grammar. Makes it randomize products so you dont have 6 pizzas on the same pixel. Gets rid of edgecases
  • Loading branch information
Tsar-Salat committed Sep 19, 2023
1 parent 2d43b56 commit 6d2c37b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
15 changes: 15 additions & 0 deletions code/__HELPERS/pronouns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,21 @@
/datum/proc/p_es(temp_gender)
. = "es"

/datum/proc/plural_s(pluralize)
switch(copytext_char(pluralize, -2))
if ("ss")
return "es"
if ("sh")
return "es"
if ("ch")
return "es"
else
switch(copytext_char(pluralize, -1))
if("s", "x", "z")
return "es"
else
return "s"

//like clients, which do have gender.
/client/p_they(capitalized, temp_gender)
if(!temp_gender)
Expand Down
7 changes: 3 additions & 4 deletions code/datums/elements/food/processable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
element_flags = ELEMENT_BESPOKE
id_arg_index = 2
///The type of atom this creates when the processing recipe is used.
var/result_atom_type
var/atom/result_atom_type
///The tool behaviour for this processing recipe
var/tool_behaviour
///Time to process the atom
Expand Down Expand Up @@ -40,8 +40,7 @@
var/found_table = locate(/obj/structure/table) in found_location
var/found_tray = locate(/obj/item/storage/bag/tray) in found_location
if(!found_turf && !istype(found_location, /obj/item/storage/bag/tray) || found_turf && !(found_table || found_tray))
to_chat(user, "<span class='notice'>You cannot make that here! You need a table or at least a tray.</span>")
to_chat(user, "<span class='notice'>You cannot make [initial(result_atom_type.name)] here! You need a table or at least a tray.</span>")
return

mutable_recipes += list(list(TOOL_PROCESSING_RESULT = result_atom_type, TOOL_PROCESSING_AMOUNT = amount_created, TOOL_PROCESSING_TIME = time_to_process))
return COMPONENT_NO_AFTERATTACK
mutable_recipes += list(list(TOOL_PROCESSING_RESULT = result_atom_type, TOOL_PROCESSING_AMOUNT = amount_created, TOOL_PROCESSING_TIME = time_to_process))\
26 changes: 20 additions & 6 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1378,16 +1378,30 @@
StartProcessingAtom(user, I, choices_to_options[pick])


/atom/proc/StartProcessingAtom(mob/living/user, obj/item/I, list/chosen_option)
/atom/proc/StartProcessingAtom(mob/living/user, obj/item/process_item, list/chosen_option)
var/processing_time = chosen_option[TOOL_PROCESSING_TIME]
to_chat(user, "<span class='notice'>You start working on [src]</span>")
if(I.use_tool(src, user, chosen_option[TOOL_PROCESSING_TIME], volume=50))
if(process_item.use_tool(src, user, processing_time, volume=50))
var/atom/atom_to_create = chosen_option[TOOL_PROCESSING_RESULT]
for(var/i = 1 to chosen_option[TOOL_PROCESSING_AMOUNT])
new atom_to_create(loc)
to_chat(user, "<span class='notice'>You manage to create [chosen_option[TOOL_PROCESSING_AMOUNT]] [initial(atom_to_create.name)] from [src]</span>")
qdel(src)
//var/list/atom/created_atoms = list() //Customfood
var/amount_to_create = chosen_option[TOOL_PROCESSING_AMOUNT]
for(var/i = 1 to amount_to_create)
var/atom/created_atom = new atom_to_create(drop_location())
created_atom.pixel_x = pixel_x
created_atom.pixel_y = pixel_y
if(i > 1)
created_atom.pixel_x += rand(-8,8)
created_atom.pixel_y += rand(-8,8)
created_atom.OnCreatedFromProcessing(user, process_item, chosen_option, src)
to_chat(user, "<span class='notice'>You manage to create [chosen_option[TOOL_PROCESSING_AMOUNT]] [initial(atom_to_create.gender) == PLURAL ? "[initial(atom_to_create.name)]" : "[initial(atom_to_create.name)][plural_s(initial(atom_to_create.name))]"] from [src].</span>")
//SEND_SIGNAL(src, COMSIG_ATOM_PROCESSED, user, process_item, created_atoms) //Custom food
UsedforProcessing(user, process_item, chosen_option)
return

/atom/proc/UsedforProcessing(mob/living/user, obj/item/used_item, list/chosen_option)
qdel(src)
return

/atom/proc/OnCreatedFromProcessing(mob/living/user, obj/item/I, list/chosen_option, atom/original_atom)
return

Expand Down

0 comments on commit 6d2c37b

Please sign in to comment.