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

IPC Cooling organ #1782

Merged
merged 30 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7dccd7e
IPC Cooling
Lexanx Jan 7, 2024
5b93978
Update external_cooling_device.dm
Lexanx Jan 7, 2024
31a989f
Update cooling_system.dm
Lexanx Jan 7, 2024
23640b0
Update cooling_system.dm
Lexanx Jan 7, 2024
8e65257
Merge branch 'dev-sierra' into IPC-organ
Lexanx Jan 7, 2024
806a9d3
some things changed
Lexanx Jan 21, 2024
7ef1d8c
update
Lexanx Jan 25, 2024
e6f97bd
Revert "update"
Lexanx Jan 25, 2024
e3bbe4d
update
Lexanx Jan 25, 2024
108f8c6
Merge branch 'dev-sierra' into IPC-organ
Lexanx Jan 25, 2024
388bd72
Update README.md
Lexanx Jan 25, 2024
8db82a6
Merge branch 'IPC-organ' of https://github.com/Lexanx/Baystation12-1 …
Lexanx Jan 25, 2024
b62fe7b
Update README.md
Lexanx Jan 25, 2024
442eeef
Update README.md
Lexanx Jan 25, 2024
13d5760
Merge branch 'dev-sierra' into IPC-organ
Lexanx Jan 25, 2024
620a2e3
Merge branch 'dev-sierra' into IPC-organ
Lexanx Feb 10, 2024
b38d81d
Update external_cooling_device.dm
Lexanx Feb 10, 2024
a345011
Update external_cooling_device.dm
Lexanx Feb 10, 2024
600f8a9
Update mods/ipc_cooling_unit/code/external_cooling_device.dm
SuhEugene Feb 10, 2024
33bc3a9
Update mods/ipc_cooling_unit/README.md
Lexanx Feb 13, 2024
61a4ef3
Update mods/ipc_cooling_unit/code/machine.dm
Lexanx Feb 13, 2024
f919117
Update mods/ipc_cooling_unit/code/machine.dm
Lexanx Feb 13, 2024
b2f271b
Update mods/ipc_cooling_unit/code/cooling_system.dm
Lexanx Feb 13, 2024
223e1e8
Update mods/ipc_cooling_unit/code/cooling_system.dm
Lexanx Feb 13, 2024
a5f16d0
Update mods/ipc_cooling_unit/code/external_cooling_device.dm
Lexanx Feb 13, 2024
6794be7
Update mods/ipc_cooling_unit/code/external_cooling_device.dm
Lexanx Feb 13, 2024
a453ea6
Update mods/ipc_cooling_unit/code/external_cooling_device.dm
Lexanx Feb 13, 2024
01f2c97
Update mods/ipc_cooling_unit/code/external_cooling_device.dm
Lexanx Feb 13, 2024
86aeabf
Merge branch 'dev-sierra' into IPC-organ
Lexanx Feb 13, 2024
d4c02ce
Update cooling_system.dm
Lexanx Feb 13, 2024
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
2 changes: 1 addition & 1 deletion baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
#include "code\__defines\xenoarcheaology.dm"
#include "code\__defines\ZAS.dm"
#include "code\__defines\zmimic.dm"
#include "code\__defines\~mods\rust_g.dm"
#include "code\__defines\~mods\expanded_culture_descriptor.dm"
#include "code\__defines\~mods\rust_g.dm"
#include "code\__defines\~mods\~master_defines.dm"
#include "code\_global_vars\edible.dm"
#include "code\_global_vars\logging.dm"
Expand Down
4 changes: 4 additions & 0 deletions code/__defines/~mods/~master_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@
// LOADOUT_ITEMS - Start
#define ACCESSORY_SLOT_OVER "Over"
// LOADOUT_ITEMS - End

// IPC_COOLING_UNIT - Start
#define BP_COOLING "cooling system"
// IPC_COOLING_UNIT - End
1 change: 1 addition & 0 deletions mods/global_modpacks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "jukebox_tapes/_jukebox_tapes.dme"
#include "loadout_items/_loadout_items.dme"
#include "lobbyscreen/_lobbyscreen.dme"
#include "ipc_cooling_unit/_ipc_cooling_unit.dme"
#include "music_player/_music_player.dme"
#include "ntnet/_ntnet.dme"
#include "nyc_posters/_nyc_posters.dme"
Expand Down
72 changes: 72 additions & 0 deletions mods/ipc_cooling_unit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@

#### Список PRов:

- https://github.com/SierraBay/SierraBay12/pull/1782
<!--
Ссылки на PRы, связанные с модом:
- Создание
- Большие изменения
-->

<!-- Название мода. Не важно на русском или на английском. -->
## Мод-пример
Lexanx marked this conversation as resolved.
Show resolved Hide resolved

ID мода: IPC_COOLING_UNIT
<!--
Название модпака прописными буквами, СОЕДИНЁННЫМИ_ПОДЧЁРКИВАНИЕМ,
которое ты будешь использовать для обозначения файлов.
-->

### Описание мода

Добавляет орган охлаждения для ИПС и внешнее охлаждающее устройство для ИПС
<!--
Что он делает, что добавляет: что, куда, зачем и почему - всё здесь.
А также любая полезная информация.
-->

### Изменения *кор кода*
- Отсутствуют

SuhEugene marked this conversation as resolved.
Show resolved Hide resolved
<!--
Если вы редактировали какие-либо процедуры или переменные в кор коде,
они должны быть указаны здесь.
Нужно указать и файл, и процедуры/переменные.

Изменений нет - напиши "Отсутствуют"
-->

### Оверрайды

- `mods\ipc_cooling_unit\code\machine.dm`: `owner.species.passive_temp_gain`
Lexanx marked this conversation as resolved.
Show resolved Hide resolved
<!--
Если ты добавлял новый модульный оверрайд, его нужно указать здесь.
Здесь указываются оверрайды в твоём моде и папке `_master_files`

Изменений нет - напиши "Отсутствуют"
-->

### Дефайны

- `code/__defines/~mods/~master_defines.dm`: `BP_COOLING`,
<!--

-->
### Используемые файлы, не содержащиеся в модпаке
- Отсуствует

SuhEugene marked this conversation as resolved.
Show resolved Hide resolved
<!--
Будь то немодульный файл или модульный файл, который не содержится в папке,
принадлежащей этому конкретному моду, он должен быть упомянут здесь.
Хорошими примерами являются иконки или звуки, которые используются одновременно
несколькими модулями, или что-либо подобное.
-->

### Авторы:

Lexanx
<!--
Здесь находится твой никнейм
Если работал совместно - никнеймы тех, кто помогал.
В случае порта чего-либо должна быть ссылка на источник.
-->
3 changes: 3 additions & 0 deletions mods/ipc_cooling_unit/_ipc_cooling_unit.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/singleton/modpack/ipc_cooling_unit
name = "Орган Охлаждения ИПС"
author = "Lexanx"
9 changes: 9 additions & 0 deletions mods/ipc_cooling_unit/_ipc_cooling_unit.dme
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef MODPACK_IPC_COOLING_UNIT
#define MODPACK_IPC_COOLING_UNIT

#include "_ipc_cooling_unit.dm"
#include "code/cooling_system.dm"
#include "code/external_cooling_device.dm"
#include "code/machine.dm"

#endif
147 changes: 147 additions & 0 deletions mods/ipc_cooling_unit/code/cooling_system.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/obj/item/organ/internal/cooling_system
name = "cooling system"
icon = 'mods/ipc_cooling_unit/icons/ipc_icons.dmi'
icon_state = "cooling0"
organ_tag = BP_COOLING
parent_organ = BP_GROIN
status = ORGAN_ROBOTIC
desc = "The internal liquid cooling system consists of a weighty humming cylinder and a small ribbed block connected by flexible tubes through which clear liquid flows."
var/refrigerant_max = 90 // Максимальное количество охладителя
var/refrigerant_rate = 5 // Чем больше это значение, тем сильнее будет идти нагрев владельца.
var/durability_factor = 30 // Чем больше это значение, тем сильнее будет идти нагрев владельца при повреждениях
var/safety = 1
damage_reduction = 0.8
max_damage = 50
var/sprite_name = "cooling"
var/fresh_coolant = 0
var/coolant_purity = 0
var/datum/reagents/coolant_reagents
var/used_coolant = 0
var/heating_modificator
var/list/coolant_reagents_efficiency = list()
var/coolant_reagent_water

/obj/item/organ/internal/cooling_system/New()
robotize()
create_reagents(refrigerant_max)
coolant_reagents_efficiency[/datum/reagent/water] = 17
coolant_reagents_efficiency[/datum/reagent/ethanol] = 10
coolant_reagents_efficiency[/datum/reagent/space_cleaner] = 5
coolant_reagents_efficiency[/datum/reagent/sterilizine] = 3
coolant_reagents_efficiency[/datum/reagent/coolant] = 0.1
reagents.add_reagent(/datum/reagent/coolant, 60)
reagents.add_reagent(/datum/reagent/water, 30)
..()

/obj/item/organ/internal/cooling_system/emp_act(severity)
damage += rand(15 - severity * 5, 20 - severity * 5)
..()
// Коэффицент эффективности работы смеси
/obj/item/organ/internal/cooling_system/proc/coolant_purity()
var/total_purity = 0
fresh_coolant = 0
coolant_purity = 0
for (var/datum/reagent/current_reagent in src.reagents.reagent_list)
if (!current_reagent)
continue
var/cur_purity = coolant_reagents_efficiency[current_reagent.type]
if(!cur_purity)
cur_purity = 25
else if(cur_purity < 0.1)
cur_purity = 0.1
total_purity += cur_purity * current_reagent.volume
fresh_coolant += current_reagent.volume
if(total_purity && fresh_coolant)
coolant_purity = total_purity / fresh_coolant
heating_modificator = coolant_purity




/obj/item/organ/internal/cooling_system/proc/get_coolant_drain()
var/damage_factor = (damage*durability_factor)/max_damage
return damage_factor

/obj/item/organ/internal/cooling_system/Process()

if(!owner || owner.stat == DEAD || owner.bodytemperature < 32)
return
coolant_purity()
handle_cooling()
..()

/obj/item/organ/internal/cooling_system/proc/handle_cooling()

var/obj/item/organ/internal/cell/C = owner.internal_organs_by_name[BP_CELL]
refrigerant_rate = heating_modificator
if (C && C.get_charge() < 25)
return
if(reagents.total_volume >= 0)
var/bruised_cost = get_coolant_drain()

if(is_bruised())
var/reagents_remove = bruised_cost/durability_factor
reagents.remove_any(reagents_remove)

if(is_damaged())
get_coolant_drain()
refrigerant_rate += bruised_cost // Нагрев владельца при повреждениях высчитывается тут.

if(reagents.get_reagent_amount(/datum/reagent/water) <= (0.3 * reagents.total_volume))
var/need_more_water = ((refrigerant_max - reagents.get_reagent_amount(/datum/reagent/water))/100)
take_internal_damage(need_more_water)

if(reagents.total_volume <= 0)
refrigerant_rate += 40

/obj/item/organ/internal/cooling_system/proc/get_tempgain()
if(owner.bodytemperature > 950 CELSIUS)
return 0
if(refrigerant_rate > 0)
return refrigerant_rate

/obj/item/organ/internal/cooling_system/proc/get_coolant_remaining()
if(status & ORGAN_DEAD)
return 0
return round(reagents.total_volume)

/obj/item/organ/internal/cooling_system/examine(mob/user, distance)
. = ..()
if(distance <= 0)
to_chat(user, text("[icon2html(src, viewers(get_turf(src)))] [] contains [] units of liquid left!", src, src.reagents.total_volume))

/obj/item/organ/internal/cooling_system/attack_self(mob/user as mob)
safety = !safety
src.icon_state = "[sprite_name][!safety]"
src.desc = "The injection is [safety ? "on" : "off"]."
to_chat(user, "The injection is [safety ? "on" : "off"].")
return
Lexanx marked this conversation as resolved.
Show resolved Hide resolved


/obj/item/organ/internal/cooling_system/afterattack(atom/target, mob/user, flag)

var/beaker = istype(target, /obj/item/reagent_containers/glass)

if (flag && beaker)
var/obj/dispenser = target
var/amount = reagents.get_free_space()
if (safety)
if (amount <= 0)
to_chat(user, SPAN_NOTICE("\The [src] is full."))
return
if (beaker)
if (dispenser.reagents.total_volume <= 0)
to_chat(user, SPAN_NOTICE("\The [dispenser] is empty."))
return
amount = dispenser.reagents.trans_to_obj(src, refrigerant_max)
to_chat(user, SPAN_NOTICE("You fill \the [src] with [amount] units from \the [dispenser]."))
playsound(src.loc, 'sound/effects/pour.ogg', 25, 1)
if (!safety)
if (beaker)
amount = src.reagents.trans_to_obj(dispenser, refrigerant_max)
to_chat(user, SPAN_NOTICE("You fill \the [dispenser] with [amount] units from \the [src]."))
playsound(src.loc, 'sound/effects/pour.ogg', 25, 1)

else
return ..()
return
Lexanx marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading