Skip to content

Commit

Permalink
Mech acceleration, mech keybinds, colony update (#2562)
Browse files Browse the repository at this point in the history
  • Loading branch information
AmShegars authored Jul 31, 2024
1 parent 995e09d commit b27000e
Show file tree
Hide file tree
Showing 34 changed files with 1,730 additions and 1,156 deletions.
2 changes: 1 addition & 1 deletion code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ var/global/list/admin_verbs_debug = list(
/datum/admins/proc/map_template_load,
/datum/admins/proc/map_template_load_new_z,
//[SIERRA-ADD] - Colony-types,
/datum/admins/proc/map_template_choose_colony_type,
/datum/admins/proc/map_template_colony_spawn_settings,
//[SIERRA-ADD],
/datum/admins/proc/map_template_upload,
/client/proc/enable_debug_verbs,
Expand Down
14 changes: 1 addition & 13 deletions code/modules/mechs/components/head.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,14 @@
camera = locate() in src
software = locate() in src

//EDIT
// [SIERRA-EDIT] - Mechs-by-Shebar
/* /obj/item/mech_component/sensors/proc/get_sight(powered)
/obj/item/mech_component/sensors/proc/get_sight(powered)
var/flags = 0
if(total_damage >= 0.8 * max_damage || !powered)
flags |= BLIND
else if(active_sensors && powered)
flags |= vision_flags
return flags
*/
/obj/item/mech_component/sensors/proc/get_sight(powered)
var/flags = 0
if(!powered ||(!camera && powered)) //Камера не работает/Ничего не запитано?
flags |= BLIND //включается слепота
if(powered && camera)
if(active_sensors) //SENSORS active? (Button)
flags |= vision_flags //Мех получает спец зрение от сенсоров

return flags
// [SIERRA-EDIT]


/obj/item/mech_component/sensors/proc/get_invisible(powered)
Expand Down
4 changes: 1 addition & 3 deletions code/modules/mechs/interface/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,6 @@
/obj/screen/movable/exosuit/toggle/power_control/toggled()
. = ..()
owner.toggle_power(usr)
//[SIERRA-ADD] - Mechs-by-Shegar
owner.update_icon()
//[SIERRA-ADD]

/obj/screen/movable/exosuit/toggle/power_control/on_update_icon()
toggled = (owner.power == MECH_POWER_ON)
Expand Down Expand Up @@ -300,6 +297,7 @@
owner.update_icon()
playsound(src.loc, 'sound/machines/suitstorage_cycledoor.ogg', 50, 1, -6)


/obj/screen/movable/exosuit/toggle/hatch_open/on_update_icon()
toggled = owner.hatch_closed
. = ..()
Expand Down
7 changes: 5 additions & 2 deletions code/modules/mechs/mech_damage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@
//[SIERRA-ADD]
//
var/ratio = get_blocked_ratio(null, DAMAGE_BURN, null, (3-severity) * 20) // HEAVY = 40; LIGHT = 20

//[SIERRA-ADD] - Mechs-by-Shegar
add_glitch_effects()
//[SIERRA-ADD] - Mechs-by-Shegar
if(ratio >= 0.5)
for(var/mob/living/m in pilots)
to_chat(m, SPAN_NOTICE("Your Faraday shielding absorbed the pulse!"))
Expand All @@ -280,7 +282,8 @@
*/
for(var/obj/item/mech_component/thing in list(arms,legs,head,body))
thing.emp_act(severity)
thing.emp_heat(severity, ratio, src)
if(power == MECH_POWER_ON)
thing.emp_heat(severity, ratio, src)
//[SIERRA-EDIT]
if(!hatch_closed || !prob(body.pilot_coverage))
for(var/thing in pilots)
Expand Down
25 changes: 25 additions & 0 deletions code/modules/mechs/mech_interaction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
var/adj = A.Adjacent(src) // Why in the fuck isn't Adjacent() commutative.

var/modifiers = params2list(params)
//[SIERRA-ADD] - Mechs-by-Shegar
if(modifiers["middle"])
swap_hardpoint(user)
return
//[SIERRA-ADD]
if(modifiers["shift"])
examinate(user, A)
return
Expand Down Expand Up @@ -421,6 +426,11 @@
/mob/living/exosuit/use_tool(obj/item/tool, mob/user, list/click_params)
// Cable Coil - Repair burn damage
if (isCoil(tool))
//[SIERRA-ADD] - Mechs-by-Shegar
if(inmech(user, src))
to_chat(user, "You cannot interacti with mech inside mech.")
return
//[SIERRA-ADD]
if (!getFireLoss())
USE_FEEDBACK_FAILURE("\The [src] has no electrical damage to repair.")
return TRUE
Expand Down Expand Up @@ -520,6 +530,11 @@
else if (istype(tool, /obj/item/device/multitool/multimeter))
can_hack_id(tool, user)
else if (isMultitool(tool))
//[SIERRA-ADD] - Mechs-by-Shegar
if(inmech(user, src))
to_chat(user, "You cannot interacti with mech inside mech.")
return
//[SIERRA-ADD]
if(id_holder)
var/list/variants = list("Restore ID data", "Dismantle equipment")
var/bla
Expand Down Expand Up @@ -566,6 +581,11 @@

// Screwdriver - Remove cell
else if (isScrewdriver(tool))
//[SIERRA-ADD] - Mechs-by-Shegar
if(inmech(user, src))
to_chat(user, "You cannot interacti with mech inside mech.")
return
//[SIERRA-ADD]
if (!maintenance_protocols)
USE_FEEDBACK_FAILURE("\The [src]'s maintenance protocols must be enabled to access the power cell.")
return TRUE
Expand Down Expand Up @@ -596,6 +616,11 @@

// Welding Tool - Repair physical damage
else if (isWelder(tool))
//[SIERRA-ADD] - Mechs-by-Shegar
if(inmech(user, src))
to_chat(user, "You cannot interacti with mech inside mech.")
return
//[SIERRA-ADD]
if (!getBruteLoss())
USE_FEEDBACK_FAILURE("\The [src] has no physical damage to repair.")
return TRUE
Expand Down
57 changes: 33 additions & 24 deletions code/modules/mechs/mech_movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,48 +101,57 @@
exosuit.visible_message(SPAN_NOTICE("\The [exosuit] moves [txt_dir]."))
//[SIERRA-ADD] - Mechs-by-Shegar - STRAFE
if(exosuit.legs.can_strafe)
for(var/thing in exosuit.pilots) //Для всех пилотов внутри
var/mob/pilot = thing
if(pilot && pilot.client)
for(var/key in pilot.client.keys_held)
if (key == "Space")
var/move_speed = exosuit.legs.move_delay
if(!exosuit.legs.good_in_strafe)
move_speed = move_speed * 2.5
if(direction == NORTHWEST || direction == NORTHEAST || direction == SOUTHWEST || direction == SOUTHEAST)
move_speed = sqrt((move_speed*move_speed) + (move_speed * move_speed))
if(move_speed > 12)
move_speed = 12
exosuit.SetMoveCooldown(exosuit.legs ? move_speed : 3)
var/turf/target_loc = get_step(exosuit, direction)
if(target_loc && exosuit.legs && exosuit.legs.can_move_on(exosuit.loc, target_loc) && exosuit.MayEnterTurf(target_loc))
exosuit.Move(target_loc)
//[SIERRA-ADD] - Mechs-by-Shegar
exosuit.add_heat(exosuit.legs.heat_generation)
//[SIERRA-ADD]
return MOVEMENT_HANDLED
if(exosuit.strafe_status)
var/move_speed = exosuit.legs.move_delay
if(!exosuit.legs.good_in_strafe)
move_speed = move_speed * 2.5
if(direction == NORTHWEST || direction == NORTHEAST || direction == SOUTHWEST || direction == SOUTHEAST)
move_speed = sqrt((move_speed*move_speed) + (move_speed * move_speed))
if(move_speed > 12)
move_speed = 12
exosuit.SetMoveCooldown(exosuit.legs ? move_speed : 3)
var/turf/target_loc = get_step(exosuit, direction)
if(target_loc && exosuit.legs && exosuit.legs.can_move_on(exosuit.loc, target_loc) && exosuit.MayEnterTurf(target_loc))
exosuit.Move(target_loc)
//[SIERRA-ADD] - Mechs-by-Shegar
exosuit.add_heat(exosuit.legs.heat_generation)
//[SIERRA-ADD]
return MOVEMENT_HANDLED
//[SIERRA-ADD]

//TURN
if(exosuit.dir != moving_dir && !(direction & (UP|DOWN)))
playsound(exosuit.loc, exosuit.legs.mech_turn_sound, 40,1)
exosuit.set_dir(moving_dir)
exosuit.SetMoveCooldown(exosuit.legs.turn_delay)
//[SIERRA-ADD] - Mechs-by-Shegar
////[SIERRA-ADD] - Mechs-by-Shegar
//Первым делом мы найдём угол между текущим диром и тот на который мы хотим перейти
if(exosuit.dir == turn(direction, 45) || exosuit.dir == turn(direction, -45))
exosuit.sub_speed( exosuit.legs.turn_diogonal_slowdown)
else if(exosuit.dir == turn(direction, 90) || exosuit.dir == turn(direction, -90))
exosuit.sub_speed( exosuit.legs.turn_slowdown )
else if(exosuit.dir == turn(direction, 135) || exosuit.dir == turn(direction, -135))
exosuit.sub_speed( (exosuit.legs.turn_slowdown + exosuit.legs.turn_diogonal_slowdown) )
else if(exosuit.dir == turn(direction, 180) || exosuit.dir == turn(direction, -180))
exosuit.legs.current_speed = exosuit.legs.min_speed
exosuit.add_heat(exosuit.legs.heat_generation)
//[SIERRA-ADD]
exosuit.set_dir(moving_dir)
exosuit.SetMoveCooldown(exosuit.legs.turn_delay)

//TURN

//MOVE
else
exosuit.SetMoveCooldown(exosuit.legs ? exosuit.legs.move_delay : 3)
//[SIERRA-EDIT] - Mechs-by-Shegar
//exosuit.SetMoveCooldown(exosuit.legs ? exosuit.legs.move_delay : 3)
exosuit.SetMoveCooldown(exosuit.legs ? exosuit.legs.current_speed : 3)
//[SIERRA-EDIT]
var/turf/target_loc = get_step(exosuit, direction)
if(target_loc && exosuit.legs && exosuit.legs.can_move_on(exosuit.loc, target_loc) && exosuit.MayEnterTurf(target_loc))
if(!exosuit.body.phazon)
exosuit.Move(target_loc)
//[SIERRA-ADD] - Mechs-by-Shegar
exosuit.add_heat(exosuit.legs.heat_generation)
exosuit.add_speed()
//[SIERRA-ADD]
else
for(var/thing in exosuit.pilots) //Для всех пилотов внутри
Expand Down
8 changes: 8 additions & 0 deletions code/modules/projectiles/projectile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,14 @@
if(!target_mob.aura_check(AURA_TYPE_BULLET, src,def_zone))
return 1
result = target_mob.bullet_act(src, def_zone)
//[SIERRA-ADD] - Mechs-by-Shegar - В меха нельзя просто так промахнуться!
if(result == PROJECTILE_FORCE_MISS && istype(target_mob, /mob/living/exosuit) )
if(prob(20))
target_mob.visible_message(SPAN_NOTICE("\The [src] rebounds from [target_mob]!"))
return
else
result = null
//[SIERRA-ADD] - Mechs-by-Shegar

if(result == PROJECTILE_FORCE_MISS)
if(!silenced)
Expand Down
1 change: 1 addition & 0 deletions mods/colony_fractions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#### Список PRов:
https://github.com/SierraBay/SierraBay12/pull/2317
https://github.com/SierraBay/SierraBay12/pull/2456
https://github.com/SierraBay/SierraBay12/pull/2562
<!--
Ссылки на PRы, связанные с модом:
- Создание
Expand Down
26 changes: 18 additions & 8 deletions mods/colony_fractions/code/admin_button.dm
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
/datum/admins/proc/map_template_choose_colony_type()
/datum/admins/proc/map_template_colony_spawn_settings()
set category = "Fun"
set desc = "Choose, which type will be next spawned colony."
set name = "Map Template - Choose colony type"
set name = "Map Template - Colony spawn settings"

if(!check_rights(R_SPAWN))
return

var/list/types = list("ГКК","ЦПСС","НАНОТРЕЙЗЕН","НЕЗАВИСИМАЯ", "СЛУЧАЙНЫЙ")
GLOB.choose_colony_type = input(usr, "Выберите, какой тип колонии будет при следующем спавне","Выберите тип колонии") as null|anything in types
if (!GLOB.choose_colony_type)
GLOB.choose_colony_type = "СЛУЧАЙНЫЙ"
log_and_message_admins("выбрал тип колонии: [GLOB.choose_colony_type] как следующий тип колонии при её спавне.")
var/list/options = list("Выбор типа следующей колонии", "Поведение при ошибке", "Вывести текущий тип")
var/choose = input(usr, "Выберите, какой параметр требуется в настройке","Выберите настройку") as null|anything in options
if(!choose)
return
else if(choose == "Выбор типа следующей колонии")
var/list/types = list("ГКК","ЦПСС","НАНОТРЕЙЗЕН","НЕЗАВИСИМАЯ", "СЛУЧАЙНЫЙ")
GLOB.choose_colony_type = input(usr, "Выберите, какой тип колонии будет при следующем спавне","Выберите тип колонии") as null|anything in types
if (!GLOB.choose_colony_type)
GLOB.choose_colony_type = "СЛУЧАЙНЫЙ"
log_and_message_admins("выбрал тип колонии: [GLOB.choose_colony_type] как следующий тип колонии при её спавне.")
else if(choose == "Поведение при ошибке")
var/list/variants = list("Игнорировать", "Прервать спавн колонии")
GLOB.error_colony_reaction = input(usr, "Выберите, как будет реагировать код на ошибку при выборе типа колонии","Выберите вариант действия") as null|anything in variants
log_and_message_admins("выбрал поведение: [GLOB.error_colony_reaction] при ошибке спавна колонии.")
else if(choose == "Вывести текущий тип")
to_chat(usr, "Последний ЗАСПАВНЕННЫЙ тип: [GLOB.last_colony_type], последний ВЫБРАННЫЙ тип:[GLOB.choose_colony_type]")
40 changes: 32 additions & 8 deletions mods/colony_fractions/code/first_colony.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GLOBAL_VAR_INIT(last_colony_type, "СЛУЧАЙНЫЙ")
GLOBAL_VAR_INIT(choose_colony_type, "СЛУЧАЙНЫЙ") //Педальки выбирают, какой тип колонии будет заспавнен

GLOBAL_VAR_INIT(error_colony_reaction, "Прервать спавн колонии")

/singleton/submap_archetype/playablecolony
crew_jobs = list(/datum/job/submap/colonist, /datum/job/submap/colonist_leader)
Expand Down Expand Up @@ -48,12 +48,14 @@ GLOBAL_VAR_INIT(choose_colony_type, "СЛУЧАЙНЫЙ") //Педальки в
else if(number < 100 || number == 100)
GLOB.last_colony_type = "НЕЗАВИСИМАЯ"
else
if(GLOB.last_colony_type != "НЕЗАВИСИМАЯ" && GLOB.last_colony_type != "ЦПСС" && GLOB.last_colony_type != "ГКК" && GLOB.last_colony_type != "НАНОТРЕЙЗЕН")
log_and_message_admins("ОШИБКА: Некорректная работа кода колонии, выбран несуществующий тип: [GLOB.choose_colony_type], попытка заспавнить [GLOB.last_colony_type].")
GLOB.last_colony_type = GLOB.choose_colony_type
if(!(GLOB.last_colony_type in list("ГКК","ЦПСС","НАНОТРЕЙЗЕН","НЕЗАВИСИМАЯ")))
log_and_message_admins("ОШИБКА: Некорректная работа кода колонии, выбран несуществующий тип: [GLOB.choose_colony_type].")
log_and_message_admins("Колония выбрана стандартного типа - НАНОТРЕЙЗЕН.")
if(GLOB.error_colony_reaction == "Прервать спавн колонии")
log_and_message_admins("Спавн колонии прерван исходя из настроек спавна колонии.")
return
GLOB.last_colony_type = "НАНОТРЕЙЗЕН"
else
GLOB.last_colony_type = GLOB.choose_colony_type
log_and_message_admins("Начал спавн колонии следующего типа: [GLOB.last_colony_type].")

.=..()
Expand Down Expand Up @@ -263,10 +265,9 @@ GLOBAL_VAR_INIT(choose_colony_type, "СЛУЧАЙНЫЙ") //Педальки в

/obj/machinery/computer/rdconsole/core/colony/New()
. = ..()
QDEL_NULL(files)
files = new
//ENGI
files.research_points = 41250

/*
files.UnlockTechology(/datum/technology/engineering)
files.UnlockTechology(/datum/technology/engineering/monitoring)
files.UnlockTechology(/datum/technology/engineering/adv_parts)
Expand Down Expand Up @@ -303,6 +304,7 @@ GLOBAL_VAR_INIT(choose_colony_type, "СЛУЧАЙНЫЙ") //Педальки в
files.UnlockTechology(/datum/technology/robo/mech_weapons)
files.UnlockTechology(/datum/technology/robo/mech_med_tools)
files.UnlockTechology(/datum/technology/robo/adv_mech_tools)
*/

/*
files.UpdateTech("materials", 7) //Материалы
Expand Down Expand Up @@ -351,6 +353,28 @@ GLOBAL_VAR_INIT(choose_colony_type, "СЛУЧАЙНЫЙ") //Педальки в
)
req_access = list()

//Пресетовая машинерия

/obj/machinery/space_heater/stationary/on/colony
set_temperature = 273.15
heating_power = 360000



/obj/machinery/power/smes/buildable/preset/colony
uncreated_component_parts = list(/obj/item/stock_parts/smes_coil/super_capacity = 1,
/obj/item/stock_parts/smes_coil/super_io = 1)
_input_maxed = TRUE
_output_maxed = TRUE
_input_on = TRUE
_output_on = TRUE
_fully_charged = TRUE

/obj/machinery/sleeper/survival_pod/colony
name = "advanced colony stasis pod"

/obj/item/storage/firstaid/fire/special/colony
name = "colony scorch first-aid kit"

/obj/machinery/vending/medical/colony
req_access = list()
11 changes: 7 additions & 4 deletions mods/colony_fractions/code/second_colony.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

/datum/map_template/ruin/exoplanet/playablecolony2/load(turf/T, centered=FALSE)
if(!GLOB.choose_colony_type)
log_and_message_admins("ОШИБКА: пустой выбранный тип колонии!.")
GLOB.choose_colony_type = "СЛУЧАЙНЫЙ"
if(GLOB.choose_colony_type == "СЛУЧАЙНЫЙ")
var/number = rand(1,100)
Expand All @@ -34,12 +35,14 @@
else if(number < 100 || number == 100)
GLOB.last_colony_type = "НЕЗАВИСИМАЯ"
else
if(GLOB.last_colony_type != "НЕЗАВИСИМАЯ" && GLOB.last_colony_type != "ЦПСС" && GLOB.last_colony_type != "ГКК" && GLOB.last_colony_type != "НАНОТРЕЙЗЕН")
log_and_message_admins("ОШИБКА: Некорректная работа кода колонии, выбран несуществующий тип: [GLOB.choose_colony_type], попытка заспавнить [GLOB.last_colony_type].")
GLOB.last_colony_type = GLOB.choose_colony_type
if(!(GLOB.last_colony_type in list("ГКК","ЦПСС","НАНОТРЕЙЗЕН","НЕЗАВИСИМАЯ")))
log_and_message_admins("ОШИБКА: Некорректная работа кода колонии, выбран несуществующий тип: [GLOB.choose_colony_type].")
log_and_message_admins("Колония выбрана стандартного типа - НАНОТРЕЙЗЕН.")
if(GLOB.error_colony_reaction == "Прервать спавн колонии")
log_and_message_admins("Спавн колонии прерван исходя из настроек спавна колонии.")
return
GLOB.last_colony_type = "НАНОТРЕЙЗЕН"
else
GLOB.last_colony_type = GLOB.choose_colony_type
log_and_message_admins("Начал спавн колонии следующего типа: [GLOB.last_colony_type].")

.=..()
Expand Down
Loading

0 comments on commit b27000e

Please sign in to comment.