Skip to content

Commit

Permalink
/
Browse files Browse the repository at this point in the history
  • Loading branch information
PlayerUnknown14 committed Dec 29, 2024
1 parent e2a725f commit f836485
Showing 1 changed file with 60 additions and 65 deletions.
125 changes: 60 additions & 65 deletions code/modules/reagents/chemistry/machinery/reagentgrinder.dm
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
/obj/machinery/reagentgrinder
name = "\improper All-In-One Grinder"
desc = "Измельчает, дробит, разжижает и извлекает вещества из предметов, помещённых внутрь. Ради всего святого, не суйте туда свои пальцы."
ru_names = list(
NOMINATIVE = "универсальный блендер",
GENITIVE = "универсального блендера",
DATIVE = "универсальному блендеру",
ACCUSATIVE = "универсальный блендер",
INSTRUMENTAL = "универсальным блендером",
PREPOSITIONAL = "универсальном блендере"
)
icon = 'icons/obj/kitchen.dmi'
icon_state = "juicer1"
layer = 2.9
Expand Down Expand Up @@ -105,13 +96,6 @@

var/list/holdingitems = list()

/obj/machinery/reagentgrinder/examine(mob/user)
. = ..()
if(panel_open)
. += span_notice("Панель техобслуживания открыта.")
if(Adjacent(user))
. += span_info("Используйте <b>Alt + ЛКМ</b>, чтобы извлечь ёмкость.")

/obj/machinery/reagentgrinder/empty
icon_state = "juicer0"
beaker = null
Expand Down Expand Up @@ -159,7 +143,6 @@
if(!anchored || beaker)
return
if(!panel_open)
balloon_alert(user, "панель закрыта!")
return
if(!I.tool_use_check(user, 0))
return
Expand All @@ -179,7 +162,6 @@
return
default_unfasten_wrench(user, I)


/obj/machinery/reagentgrinder/attackby(obj/item/I, mob/user, params)
if(user.a_intent == INTENT_HARM)
return ..()
Expand All @@ -190,15 +172,15 @@
if(istype(I, /obj/item/reagent_containers) && (I.container_type & OPENCONTAINER))
add_fingerprint(user)
if(panel_open)
balloon_alert(user, "панель открыта!")
to_chat(user, span_warning("Close the maintenance panel first."))
return ATTACK_CHAIN_PROCEED
if(beaker)
balloon_alert(user, "слот для ёмкости занят!")
to_chat(user, span_warning("The [name] already has [beaker] loaded."))
return ATTACK_CHAIN_PROCEED
if(!user.drop_transfer_item_to_loc(I, src))
return ..()
beaker = I
balloon_alert(user, "ёмкость установлена")
to_chat(user, span_notice("You have inserted [I] into [src]."))
updateUsrDialog()
update_icon(UPDATE_ICON_STATE)
return ATTACK_CHAIN_BLOCKED_ALL
Expand All @@ -207,19 +189,19 @@
if(is_type_in_list(I, dried_items) && istype(I, /obj/item/reagent_containers/food/snacks/grown))
var/obj/item/reagent_containers/food/snacks/grown/grown = I
if(!grown.dry)
balloon_alert(user, "сначала высушите!")
to_chat(user, span_warning("You must dry that first."))
return ATTACK_CHAIN_PROCEED

if(length(holdingitems) >= limit)
balloon_alert(user, "нет места!")
to_chat(user, span_warning("The [name] cannot hold anymore items."))
return ATTACK_CHAIN_PROCEED

//Fill machine with a bag!
if(istype(I, /obj/item/storage/bag))
var/obj/item/storage/bag/bag = I
var/original_contents_len = length(bag.contents)
if(!length(bag.contents))
balloon_alert(user, "нечего загружать!")
to_chat(user, span_warning("The [bag.name] is empty."))
return ATTACK_CHAIN_PROCEED

for(var/obj/item/thing as anything in bag.contents)
Expand All @@ -231,31 +213,54 @@

var/new_contents_len = length(bag.contents)
if(new_contents_len == original_contents_len)
balloon_alert(user, "нечего загружать!")
to_chat(user, span_warning("Nothing in [bag] can be put into [src]."))
return ATTACK_CHAIN_PROCEED
user.visible_message(
span_notice("[user] загрузил[pluralize_ru(user.gender, "", "а", "о", "и")] содержимое [bag.declent_ru(GENITIVE)] в [declent_ru(ACCUSATIVE)]."),
span_notice("Вы загрузили содержимое [bag.declent_ru(GENITIVE)] в [declent_ru(ACCUSATIVE)]."))
balloon_alert(user, "содержимое загружено")

to_chat(user, span_notice("You have emptied [new_contents_len ? "some" : "all"] of [bag]'s contents into [src]."))
updateUsrDialog()
return ATTACK_CHAIN_PROCEED_SUCCESS

if(!is_type_in_list(I, blend_items) && !is_type_in_list(I, juice_items))
balloon_alert(user, "не подходит!")
to_chat(user, span_warning("Cannot refine [I] into a reagent."))
return ATTACK_CHAIN_PROCEED

if(!user.drop_transfer_item_to_loc(I, src))
return ..()

holdingitems += I
user.visible_message(
span_notice("[user] загрузил[pluralize_ru(user.gender, "", "а", "о", "и")] [I.declent_ru(ACCUSATIVE)] в [declent_ru(ACCUSATIVE)]."),
span_notice("Вы загрузили [I.declent_ru(ACCUSATIVE)] в [declent_ru(ACCUSATIVE)]."))
balloon_alert(user, "загружено в камеру")
updateUsrDialog()
return ATTACK_CHAIN_BLOCKED_ALL

/obj/machinery/reagentgrinder/examine(mob/user)
. = ..()
if(in_range(src, user))
. += "<span class='info'>Alt-click to activate it.<br/>Ctrl-Shift-click to dispose content.</span>"

/obj/machinery/reagentgrinder/AltClick(mob/living/carbon/human/human)
if(!istype(human) || !human.Adjacent(src))
return

if(human.incapacitated() || HAS_TRAIT(human, TRAIT_HANDS_BLOCKED))
return

if(operating)
return

add_fingerprint(human)
grind()

/obj/machinery/reagentgrinder/CtrlShiftClick(mob/living/carbon/human/human)
if(!istype(human) || !human.Adjacent(src))
return

if(human.incapacitated() || HAS_TRAIT(human, TRAIT_HANDS_BLOCKED))
return

if(operating)
return

add_fingerprint(human)
detach(human)

/obj/machinery/reagentgrinder/attack_ai(mob/user)
return FALSE
Expand All @@ -275,40 +280,40 @@

if(!operating)
for (var/obj/item/O in holdingitems)
processing_chamber += "\A [O.declent_ru(NOMINATIVE)]<BR>"
processing_chamber += "\A [O.name]<BR>"

if (!processing_chamber)
is_chamber_empty = 1
processing_chamber = "Ничего."
processing_chamber = "Nothing."
if (!beaker)
beaker_contents = "<B>Ёмкость не установлена.</B><br>"
beaker_contents = "<B>No beaker attached.</B><br>"
else
is_beaker_ready = 1
beaker_contents = "<B>Содержимое ёмкости:</B><br>"
beaker_contents = "<B>The beaker contains:</B><br>"
var/anything = 0
for(var/datum/reagent/R in beaker.reagents.reagent_list)
anything = 1
beaker_contents += "[R.volume] - [R.name]<br>"
if(!anything)
beaker_contents += "Ничего<br>"
beaker_contents += "Nothing<br>"


dat += {"
<b>Содержимое камеры:</b><br>
<b>Processing chamber contains:</b><br>
[processing_chamber]<br>
[beaker_contents]<hr>
"}
if (is_beaker_ready && !is_chamber_empty && !(stat & (NOPOWER|BROKEN)))
dat += "<a href='byond://?src=[src.UID()];action=grind'>Измельчить</a><BR>"
dat += "<a href='byond://?src=[src.UID()];action=juice'>Выжать</a><BR><BR>"
dat += "<a href='byond://?src=[src.UID()];action=grind'>Grind the reagents</a><BR>"
dat += "<a href='byond://?src=[src.UID()];action=juice'>Juice the reagents</a><BR><BR>"
if(holdingitems && holdingitems.len > 0)
dat += "<a href='byond://?src=[src.UID()];action=eject'>Вынуть содержимое камеры</a><BR>"
dat += "<a href='byond://?src=[src.UID()];action=eject'>Eject the reagents</a><BR>"
if (beaker)
dat += "<a href='byond://?src=[src.UID()];action=detach'>Извлечь ёмкость</a><BR>"
dat += "<a href='byond://?src=[src.UID()];action=detach'>Detach the beaker</a><BR>"
else
dat += "Пожалуйста, подождите..."
dat += "Please wait..."

var/datum/browser/popup = new(user, "reagentgrinder", "Универсальный блендер")
var/datum/browser/popup = new(user, "reagentgrinder", "All-In-One Grinder")
popup.set_content(dat)
popup.open(1)
return
Expand All @@ -328,33 +333,23 @@
if("eject")
eject()
if ("detach")
detach()
detach(usr)

/obj/machinery/reagentgrinder/proc/detach(mob/user)
if(user.stat)
return

/obj/machinery/reagentgrinder/AltClick(mob/living/user)
if(!beaker)
return
beaker.forceMove(loc)
if(Adjacent(user) && !issilicon(user))
user.put_in_hands(beaker, ignore_anim = FALSE)
balloon_alert(user, "ёмкость извлечена")

beaker.forceMove(get_turf(src))
beaker = null
add_fingerprint(user)

update_icon(UPDATE_ICON_STATE)
updateUsrDialog()

/obj/machinery/reagentgrinder/proc/detach()
if (usr.stat != 0)
return
if (!beaker)
return
beaker.loc = src.loc
if(Adjacent(usr) && !issilicon(usr))
usr.put_in_hands(beaker, ignore_anim = FALSE)
beaker = null
update_icon(UPDATE_ICON_STATE)
updateUsrDialog()

/obj/machinery/reagentgrinder/proc/eject()

if (usr.stat != 0)
return
if (holdingitems && holdingitems.len == 0)
Expand Down

0 comments on commit f836485

Please sign in to comment.