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

Adherent Discharge #1653

Merged
merged 9 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3327,6 +3327,7 @@
#include "maps\_maps.dm"
#include "mods\_modpack.dm"
#include "mods\global_modpacks.dm"
#include "mods\_master_files\code\_onclick\click.dm"
#include "mods\_master_files\code\game\world.dm"
#include "mods\_master_files\code\game\gamemodes\ert.dm"
#include "mods\_master_files\code\game\objects\effects\decals\contraband.dm"
Expand Down Expand Up @@ -3365,6 +3366,7 @@
#include "mods\_master_files\code\modules\mob\new_player\new_player.dm"
#include "mods\_master_files\code\modules\power\gravitygenerator.dm"
#include "mods\_master_files\code\modules\projectiles\projectile\bullets.dm"
#include "mods\_master_files\code\modules\species\station\adherent.dm"
#include "mods\_master_files\maps\mapsystem\maps.dm"
#include "mods\_master_files\maps\sierra\sierra_ranks.dm"
#include "mods\_master_files\maps\sierra\items\rigs.dm"
Expand Down
55 changes: 55 additions & 0 deletions mods/_master_files/code/_onclick/click.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/mob/living/carbon/human/AltClickOn(atom/A)
if(get_dist(src, A) > 1)
return ..()
if(!stat && mind && ismob(A) && (A != src) && (src.species.name == SPECIES_ADHERENT))
var/mob/living/carbon/human/adherent = src
var/obj/item/organ/internal/cell/adherent/adherent_core = adherent.internal_organs_by_name[BP_CELL]
if(adherent_core.ready_to_charge)
var/mob/living/carbon/human/target_human = A
var/mob/living/target = A
var/obj/item/cell/target_cell
var/obj/item/cell/adherent_cell
var/obj/item/organ/internal/cell/acell = locate() in adherent.internal_organs
if(acell && acell.cell)
adherent_cell = acell.cell

if(adherent_cell && adherent_cell.charge <= 2000)
to_chat(src, SPAN_WARNING("Your cell charge is too low for this action."))
return

if(ishuman(target_human))
var/obj/item/organ/internal/cell/cell = locate() in target_human.internal_organs
if(cell && cell.cell)
target_cell = cell.cell
else if(isrobot(target))
var/mob/living/silicon/robot/robot = target
target_cell = robot.get_cell()

target.visible_message(SPAN_WARNING("There is a loud crack and the smell of ozone as \the [adherent] touches \the [target]."))
playsound(loc, 'sound/effects/snap.ogg', 50, 1)

if(target_cell)
if(target_cell.maxcharge > (target_cell.charge + 2000))
target_cell.charge += 2000
else
target_cell.charge = target_cell.maxcharge
to_chat(target, SPAN_NOTICE("<b>Your [target_cell] has been charged.</b>"))
adherent_cell.charge -= 2000
if(istype(target_human) && target_human.species.name == SPECIES_ADHERENT)
next_click = world.time + 2 SECONDS
return
if(isrobot(target))
target.apply_damage(100, DAMAGE_BURN, def_zone = src.zone_sel.selecting)
visible_message(SPAN_DANGER("[adherent] touches [target] with bright electrical arc connecting them."))
to_chat(target, SPAN_DANGER("<b>You detect damage to your components!</b>"))
else if(ishuman(target))
target.electrocute_act(100, src, def_zone = src.zone_sel.selecting)
visible_message(SPAN_DANGER("With bright electrical flash [adherent] touches [target] using it's tentacles."))
else
target.apply_damage(100, DAMAGE_BURN, def_zone = src.zone_sel.selecting)
visible_message(SPAN_DANGER("With bright electrical flash [adherent] touches [target] using it's tentacles."))
admin_attack_log(src, target, "Has electrocuted", "Has been electrocuted", "electrocuted")
target.throw_at(get_step(target,get_dir(src,target)), 5, 10)
next_click = world.time + 2 SECONDS
return
return ..()
4 changes: 4 additions & 0 deletions mods/_master_files/code/modules/species/station/adherent.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/datum/species/adherent/New()
LAZYINITLIST(inherent_verbs)
inherent_verbs += /mob/living/carbon/human/proc/toggle_emergency_discharge
..()
74 changes: 74 additions & 0 deletions mods/adherent_discharge/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@

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

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

<!-- Название мода. Не важно на русском или на английском. -->
## Adherent Discharge

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

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

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

### Изменения *кор кода*

- Отсутствуют
<!--
Если вы редактировали какие-либо процедуры или переменные в кор коде,
они должны быть указаны здесь.
Нужно указать и файл, и процедуры/переменные.

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

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

- `mods/_master_files/code/_onclick/click.dm`: `/mob/living/carbon/human/AltClickOn()`
- `mods/_master_files/code/modules/species/station/adherent.dm`: `/datum/species/adherent/New()`
<!--
Если ты добавлял новый модульный оверрайд, его нужно указать здесь.
Здесь указываются оверрайды в твоём моде и папке `_master_files`

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

### Дефайны

- Отсутствуют
<!--
Если требовалось добавить какие-либо дефайны, укажи файлы,
в которые ты их добавил, а также перечисли имена.
И то же самое, если ты используешь дефайны, определённые другим модом.

Не используешь - напиши "Отсутствуют"
-->

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

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

### Авторы:

Lexanx
4 changes: 4 additions & 0 deletions mods/adherent_discharge/_adherent_discharge.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/singleton/modpack/adherent_discharge
name = "Adherent Discharge"
desc = "Добавляет Адхерентам кнопку удара электричеством."
author = "Lexanx"
6 changes: 6 additions & 0 deletions mods/adherent_discharge/_adherent_discharge.dme
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef MODPACK_ADHERENT_DISCHARGE
#define MODPACK_ADHERENT_DISCHARGE

#include "_adherent_discharge.dm"
#include "code/adherent.dm"
#endif
21 changes: 21 additions & 0 deletions mods/adherent_discharge/code/adherent.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/obj/item/organ/internal/cell/adherent
var/ready_to_charge


/mob/living/carbon/human/proc/toggle_emergency_discharge()
set category = "Abilities"
set name = "Toggle emergency discharge"
set desc = "Allows you to overload your piezo capacitors."

var/mob/living/carbon/human/adherent = src
var/obj/item/organ/internal/cell/adherent/adherent_core = adherent.internal_organs_by_name[BP_CELL]
if(!adherent_core.ready_to_charge)
adherent_core.ready_to_charge = TRUE
to_chat(src, SPAN_WARNING("The emergency discharge is ready for use."))
to_chat(src, SPAN_GOOD("You are ready to discharge, use alt+click on target to electrocute them."))
adherent.visible_message(SPAN_WARNING("You hear silent crackle sounds from [adherent] tentacles"))
playsound(loc, 'mods/adherent_discharge/sounds/discharge_on.ogg', 40, 1)
return

adherent_core.ready_to_charge = FALSE
to_chat(src, SPAN_WARNING("You have relieved the tension of your tentacles."))
Binary file added mods/adherent_discharge/sounds/discharge_on.ogg
Binary file not shown.
1 change: 1 addition & 0 deletions mods/global_modpacks.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SIERRA TODO: GET RID OF IT!!!
#include "ai/_ai.dme"
#include "adherent_discharge/_adherent_discharge.dme"
#include "body_markings/_body_markings.dme"
#include "client_verbs/_client_verbs.dme"
// #include "don_loadout/_don_loadout.dme" // Не открывать до Рождества
Expand Down
2 changes: 1 addition & 1 deletion mods/ipc_cooling_unit/code/machine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
if(statpanel("Status"))
var/obj/item/organ/internal/cell/potato = internal_organs_by_name[BP_CELL]
var/obj/item/organ/internal/cooling_system/coolant = internal_organs_by_name[BP_COOLING]
if(potato && potato.cell)
if(potato && potato.cell && src.is_species(SPECIES_IPC))
stat("Coolant remaining:","[coolant.get_coolant_remaining()]/[coolant.refrigerant_max]")

/obj/item/organ/internal/cell/Process()
Expand Down