Skip to content

Commit

Permalink
Mechs balance feature, fixes (#2779)
Browse files Browse the repository at this point in the history
  • Loading branch information
AmShegars authored Nov 3, 2024
1 parent 6078922 commit 563416a
Show file tree
Hide file tree
Showing 9 changed files with 429 additions and 368 deletions.
2 changes: 2 additions & 0 deletions mods/mechs_by_shegar/_mechs_by_shegar.dme
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
#include "code/mech_interaction.dm"
#include "code/mech_life.dm"
#include "code/mech_move.dm"
#include "code/mech_repair.dm"
#include "code/mech_uplink.dm"
#include "code/mech_vision.dm"
#include "code/mech.dm"
#include "code/minor_stuff.dm"
#include "code/new_prices.dm"
Expand Down
27 changes: 26 additions & 1 deletion mods/mechs_by_shegar/code/components/body.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
var/overheat_time = 10 SECONDS
///Куллдаун для обработки тепла.
var/heat_process_speed = 2 SECONDS
///Выбито ли пузо?
var/body_critical_damaged = FALSE


/obj/item/mech_component/chassis/proc/atmos_clear_protocol(mob/living/user)
Expand All @@ -35,7 +37,30 @@
cockpit.gas = good_gas
cockpit.temperature = 293.152

//air_contents
///Пузо было выбито
/obj/item/mech_component/chassis/part_has_been_destroyed()
if(!body_critical_damaged)
body_critical_damaged = TRUE
addtimer(new Callback(src, PROC_REF(do_overheat)), rand(20 SECONDS, 40 SECONDS))

/obj/item/mech_component/chassis/proc/do_overheat()
//Произошёл баг или иное чудо
if(!loc)
return
//Меху зачинили пузо, просчитывать больше не нужно
if(total_damage != max_damage)
return
//Определяем нашего меха
var/mob/living/exosuit/mech = loc
mech.add_heat(mech.max_heat)
if(body_critical_damaged)
addtimer(new Callback(src, PROC_REF(do_overheat)), rand(60 SECONDS, 180 SECONDS))



/obj/item/mech_component/chassis/part_has_been_restored()
body_critical_damaged = FALSE


/obj/item/mech_component/chassis/powerloader
max_damage = 100
Expand Down
7 changes: 7 additions & 0 deletions mods/mechs_by_shegar/code/components/components.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@
current_hp = max_damage
. = ..()

///Состояние части упало до 0
/obj/item/mech_component/proc/part_has_been_destroyed()

///Состояние части поднялось выше 0.
/obj/item/mech_component/proc/part_has_been_restored()


/obj/item/mech_component/proc/emp_heat(severity, emp_armor, mob/living/exosuit/mech) //Накидываем тепло учитывая армор меха
if(emp_armor > 0.8)
emp_armor = 0.8
Expand Down
110 changes: 0 additions & 110 deletions mods/mechs_by_shegar/code/components/head.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,113 +49,3 @@
emp_heat_generation = 100
weight = 75

/obj/item/mech_component/sensors/get_sight(powered)
var/flags = 0
if(powered && camera)
if(active_sensors) //SENSORS active? (Button)
flags |= vision_flags //Мех получает спец зрение от сенсоров

return flags

/mob/living/exosuit/handle_vision(powered)
var/was_blind = sight & BLIND
if(head)
sight = head.get_sight(powered)
see_invisible = head.get_invisible(powered)
if(sight & BLIND && !was_blind)
for(var/mob/pilot in pilots)
to_chat(pilot, SPAN_WARNING("The sensors are not operational and you cannot see a thing!"))
if(need_update_sensor_effects)
check_sensors_blind()
if(have_emp_effect)
process_glich()

///Прок отвечает за обновление сенсоров от слепоты.
/mob/living/exosuit/proc/check_sensors_blind()
if(body && (body.pilot_coverage < 100 || body.transparent_cabin) || !hatch_closed)
need_update_sensor_effects = FALSE
if(have_no_sensors_effect)
remove_no_signal_effect()
if(have_no_power_effect)
remove_no_power_effect()
return

if(power != MECH_POWER_ON && hatch_closed) //Кабина закрыта и нет питания. Нужно накладывать лишь no_power эффект
if(have_no_sensors_effect)
remove_no_signal_effect()
need_update_sensor_effects = FALSE
add_no_power_effect()
else if(power == MECH_POWER_ON && hatch_closed) //Кабина закрыта, есть питание. Нужно накладывать лишь no_signal (Потеря камеры)
if(have_no_power_effect)
remove_no_power_effect()
if(!head.camera)
add_no_signal_effect()
need_update_sensor_effects = FALSE
if(head.camera)
remove_no_signal_effect()
need_update_sensor_effects = FALSE


/mob/living/exosuit/proc/clear_sensors_effects(mob/living/pilot)
if(have_emp_effect)
pilot.overlay_fullscreen("sensoremp")
if(have_no_sensors_effect)
pilot.clear_fullscreen("sensorblind")
if(have_no_power_effect)
pilot.clear_fullscreen("nopower")

/obj/screen/fullscreen/mech_sensors_blind
icon = 'mods/mechs_by_shegar/icons/mech_glitch.dmi'
icon_state = "glitch_scan"
layer = BLIND_LAYER
scale_to_view = TRUE

/obj/screen/fullscreen/mech_sensors_glitchs
icon = 'mods/mechs_by_shegar/icons/mech_glitch.dmi'
icon_state = "glitch_eye"
layer = BLIND_LAYER
scale_to_view = TRUE

/obj/screen/fullscreen/mech_no_power
icon = 'mods/mechs_by_shegar/icons/mech_glitch.dmi'
icon_state = "no_power"
layer = BLIND_LAYER
scale_to_view = TRUE

/mob/living/exosuit/proc/process_glich()
if((world.time - last_keybind_use) < 0.5 SECONDS)
return
remove_glitch_effects()

/mob/living/exosuit/proc/add_no_signal_effect()
have_no_sensors_effect = TRUE
for(var/mob/living/pilot in pilots)
pilot.overlay_fullscreen("sensorblind", /obj/screen/fullscreen/mech_sensors_blind)

/mob/living/exosuit/proc/remove_no_signal_effect()
if(have_no_sensors_effect)
have_no_sensors_effect = FALSE
for(var/mob/living/pilot in pilots)
pilot.clear_fullscreen("sensorblind")

/mob/living/exosuit/proc/add_glitch_effects()
have_emp_effect = TRUE
for(var/mob/living/pilot in pilots)
pilot.overlay_fullscreen("sensoremp", /obj/screen/fullscreen/mech_sensors_glitchs)

/mob/living/exosuit/proc/remove_glitch_effects()
if(have_emp_effect)
have_emp_effect = FALSE
for(var/mob/living/pilot in pilots)
pilot.clear_fullscreen("sensoremp")

/mob/living/exosuit/proc/add_no_power_effect()
have_no_power_effect = TRUE
for(var/mob/living/pilot in pilots)
pilot.overlay_fullscreen("nopower", /obj/screen/fullscreen/mech_no_power)

/mob/living/exosuit/proc/remove_no_power_effect()
if(have_no_power_effect)
have_no_power_effect = FALSE
for(var/mob/living/pilot in pilots)
pilot.clear_fullscreen("nopower")
5 changes: 3 additions & 2 deletions mods/mechs_by_shegar/code/interface.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
.=..()



/mob/living/exosuit/toggle_power(mob/user)
if(!body.cell.check_charge(50) && power == MECH_POWER_OFF)
to_chat(user, SPAN_WARNING("Error: Not enough power for power up."))
Expand All @@ -83,6 +82,7 @@
to_chat(user, SPAN_WARNING("Error: overheat detected, safe protocol active."))
return
.=..()
check_sensors_blind()

/mob/living/exosuit/proc/fast_toggle_power(mob/user)
//Данная функция - "Быстрый старт", тратящий энергию батареи и поднимающий температуру меха.
Expand All @@ -98,7 +98,7 @@
playsound(src, 'mods/mechs_by_shegar/sounds/mecha_fast_power_up.ogg', 70, 0)
power = MECH_POWER_ON
hud_power_control.update_icon()
//hud_power_control?.queue_icon_update()
check_sensors_blind()
add_heat(100)
var/obj/item/cell/cell = src.get_cell()
cell.use(100)
Expand All @@ -110,6 +110,7 @@
/mob/living/exosuit/proc/fast_toggle_power_garanted(mob/user)
if(get_cell(TRUE))
power = MECH_POWER_ON
check_sensors_blind()
hud_power_control.update_icon()
update_icon()
else
Expand Down
Loading

0 comments on commit 563416a

Please sign in to comment.