Skip to content

Commit

Permalink
Merge pull request Civ13#2759 from HaultyAnonie/dehydrator
Browse files Browse the repository at this point in the history
Production Dehydrator Update
  • Loading branch information
savethetreez authored Apr 23, 2024
2 parents 71efa68 + 2a814c6 commit 1f13620
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions code/modules/1713/production.dm
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@
// Alghorithm will try to rotate item if not empty space are found. For example 1x3 item (dry_size=9) not found a place, but dehydrator have free row, and item will placed 3x1 (as dry_size=3).
// ====================================================================
// Items must have an icon in 'icons/obj/food/dryer.dmi' named the same as icon_state of drying product
// Items must have an icon in 'icons/obj/food/dryer.dmi' named as icon_state of drying product with additional "R" at end. For exapmle "rawcutletR"
// Items must have an icon in 'icons/obj/food/dryer.dmi' named as icon_state of drying product with additional "R" at end. For example "rawcutletR"
// Product (dried and ready) items must have an icons with normal and rotated states in 'icons/obj/food/dryer.dmi'
// Items with size of 4 rows (dry_size=13..15) or equal side sizes (1x1, 2x2, 3x3) may not have an icon with additional "R".
// For optimization try don't use dry_size 4, 8 and 12. Use instead 13, 14 and 15. Also, this will save you from having to draw two icons: straight and rotated; it will be enough to draw only one straight icon.
Expand Down Expand Up @@ -681,26 +681,27 @@

/obj/structure/dehydrator/proc/dry_as_text(var/obj/item/I)
switch(get_dry_timer(I)/TIME_TO_DRY)
if (0 to 0.15) return "not dried"
if (0.15 to 0.4) return "a quarter dry"
if (0 to 0.15) return "drying"
if (0.15 to 0.4) return "quarter dried"
if (0.4 to 0.6) return "half dried"
if (0.6 to 0.85) return "three quarters dry"
if (0.6 to 0.85) return "three quarters dried"
if (1 to INFINITY)
if (!findtext(normal_item_name(I),"dried"))
if (!findtext(normal_item_name(I),"dry")) //two if for optimization purpose
if (!findtext(normal_item_name(I),"dried")) // Look at normal_item_name()
if (!findtext(normal_item_name(I),"dry")) //two if for optimization purpose (This breaks because the name "dried" is in the final product, and so it bugs out and adds an extra space before the dry_as_text descriptor.)
return "dried"
else
return ""
else return "almost dry"
else
return "almost dried"

/obj/structure/dehydrator/examine(mob/user, distance)
..(user, distance)
var/list/dryed_now = list()
var/additional_info = in_range(user, src) || isghost(user)
if (storage.contents.len>0)
for(var/obj/item/I in storage.contents)
dryed_now += "[additional_info ? "[dry_as_text(I)] " : ""][normal_item_name(I)]"
user << "<span class='notice'>There [storage.contents.len == 1 ? "is dries" : "are drying"] [english_list(dryed_now, "")].</span>"
dryed_now += "[additional_info ? "[dry_as_text(I)]" : ""] [normal_item_name(I)]"
to_chat(user, SPAN_NOTICE("There hangs \a [english_list(dryed_now, and_text = " and a ")].")) // \a because we need "there hangs an almost dried..."

/obj/structure/dehydrator/proc/normal_item_name(var/obj/item/I)
return copytext(I.name, 1, findtext(I.name, "ON_DEHYDRATOR"))
Expand Down Expand Up @@ -788,7 +789,7 @@
if (!P.dried_type)
set_dry_timer(P, TIME_TO_DRY+1)
qdel(I)
P.visible_message("[normal_item_name(P)] finishes drying.")
P.visible_message(SPAN_WARNING("\The [normal_item_name(P)] on \the [src] finishes drying."))
update_icon()
dry_process(this_process)

Expand Down

0 comments on commit 1f13620

Please sign in to comment.