diff --git a/code/modules/overmap/helm.dm b/code/modules/overmap/helm.dm index 49a8a4af6716..68417be20bf7 100644 --- a/code/modules/overmap/helm.dm +++ b/code/modules/overmap/helm.dm @@ -294,7 +294,7 @@ switch(action) // Universal topics // [CELADON-ADD] - OVERMAP STUFF - Это вагабонд насрал if("sensor_increase") - current_ship.sensor_range = min(5, current_ship.sensor_range+1) + current_ship.sensor_range = min(10, current_ship.sensor_range+1) update_static_data(usr, ui) current_ship.token.update_screen() return diff --git a/code/modules/overmap/overmap_token.dm b/code/modules/overmap/overmap_token.dm index a6c8adb0dc62..de834abeaed3 100644 --- a/code/modules/overmap/overmap_token.dm +++ b/code/modules/overmap/overmap_token.dm @@ -125,7 +125,10 @@ var/list/visible_turfs = list() // [CELADON-EDIT] - OVERMAP SENSOR - Это вагабонд насрал // for(var/turf/T in view(4, get_turf(src))) - for(var/turf/T in view(parent.sensor_range, get_turf(src))) + if(istype(parent, /datum/overmap/ship/controlled)) + var/datum/overmap/ship/controlled/C = parent + C.recalculate_radars() + for(var/turf/T in view(min(max(1, parent.max_sensor), parent.sensor_range), get_turf(src))) // [/CELADON-EDIT] visible_turfs += T @@ -134,6 +137,16 @@ var/size_y = bbox[4] - bbox[2] + 1 cam_screen?.vis_contents = visible_turfs - cam_background.icon_state = "clear" + //[CELADON-EDIT] - RADAR + //cam_background.icon_state = "clear" + if(parent.sensor_range > parent.max_sensor) + cam_background.icon = 'icons/effects/effects.dmi' + cam_background.icon_state = "static_base" + cam_screen.alpha = max(0, 255-abs(parent.max_sensor-parent.sensor_range)*128) + else + cam_background.icon_state = "clear" + cam_background.icon = initial(cam_background.icon) + cam_screen.alpha = 255 + //[/CELADON-EDIT] cam_background.fill_rect(1, 1, size_x, size_y) return TRUE diff --git a/mod_celadon/mod_celadon.dme b/mod_celadon/mod_celadon.dme index 15927c75208b..a56871431e52 100644 --- a/mod_celadon/mod_celadon.dme +++ b/mod_celadon/mod_celadon.dme @@ -63,6 +63,7 @@ #include "tajara/_tajara.dme" #include "turrets/_turrets.dme" #include "weapons/_weapons.dme" +#include "radar/_radar.dme" // --- MOBS --- // #include "drakeborgs/_drakeborgs.dme" diff --git a/mod_celadon/radar/README.md b/mod_celadon/radar/README.md new file mode 100644 index 000000000000..300adadcd7c8 --- /dev/null +++ b/mod_celadon/radar/README.md @@ -0,0 +1,97 @@ + +#### Список PRов + +- https://github.com/CeladonSS13/Shiptest/pulls/##### + + + +## НАЗВАНИЕ_МОДА + +ID мода: RADAR + + +### Описание мода + +Добавляет радары как машинерию на шипы + + +### Используется в других проектах? +- Нет + + +### Изменения *кор кода* + +- code\modules\overmap\overmap_token.dm + + +### Оверрайды + +- Отсутствуют + + +### Дефайны + +- Отсутствуют + + +### Используемые файлы, не содержащиеся в модпаке + +- Отсутствуют + + +### Авторы + +Vagabond05 + diff --git a/mod_celadon/radar/_radar.dm b/mod_celadon/radar/_radar.dm new file mode 100644 index 000000000000..4101a1b6005d --- /dev/null +++ b/mod_celadon/radar/_radar.dm @@ -0,0 +1,27 @@ +/// name - название модпака. Используется для поиска других модпаков в init. +/// desc - описание для модпака. Может использоваться для списка глаголов модпака в качестве описания. +/// author - автор(ы) этого модпака. + +/datum/modpack/radar + name = "RADAR" + desc = "Радары." + author = "Vagabond05" + +/// Эти проки нужны, для того чтобы инициализировать датумы в определенный момент времени +/// сборки билда. Инициализация обновляет данные в билде повторно, перезаписывая новыми значениями +/// из модпака. Но иногда, сама инциализация есть и вызывается в кор коде в определенный момент, и +/// тогда такие проки не нужны и вовсе. Также проки не нужны если в модпаке только объекты находятся. +/// Если эти конструкции не нужны, просто закоментируй их! +/// (можешь использовать все три, но запуск билда увеличится на 0.1 сек, за каждый датум в модпаке) + +// Инициализация ДО +/datum/modpack/radar/pre_initialize() + . = ..() + +// Инициализация ВОВРЕМЯ +/datum/modpack/radar/initialize() + . = ..() + +// Инициализация ПОСЛЕ +/datum/modpack/radar/post_initialize() + . = ..() diff --git a/mod_celadon/radar/_radar.dme b/mod_celadon/radar/_radar.dme new file mode 100644 index 000000000000..2b5413ed62e3 --- /dev/null +++ b/mod_celadon/radar/_radar.dme @@ -0,0 +1,17 @@ +#ifndef MODPACK_CELADON_EXAMPLE +#define MODPACK_CELADON_EXAMPLE + +#include "_radar.dm" + +#include "code/radar.dm" + +#endif +// BEGIN_INTERNALS +// END_INTERNALS +// BEGIN_FILE_DIR +#define FILE_DIR . +// END_FILE_DIR +// BEGIN_PREFERENCES +// END_PREFERENCES +// BEGIN_INCLUDE +// END_INCLUDE diff --git a/mod_celadon/radar/code/radar.dm b/mod_celadon/radar/code/radar.dm new file mode 100644 index 000000000000..727929b6858d --- /dev/null +++ b/mod_celadon/radar/code/radar.dm @@ -0,0 +1,124 @@ +/datum/overmap + var/max_sensor = 4 + +/datum/overmap/ship/controlled + var/list/radars = list() + +/datum/overmap/ship/controlled/Initialize() + . = ..() + recalculate_radars() + +/datum/overmap/ship/controlled/proc/recalculate_radars() + if(length(radars)) + var/overall_sensor = -4 + for(var/obj/machinery/space_radar/R in radars) + if(R) + if(R.is_operational && R.check_outside()) + if(R.efficiency > overall_sensor) + overall_sensor = R.efficiency + max_sensor = overall_sensor + else + max_sensor = -4 + +/datum/looping_sound/space_radar + start_sound = 'mod_celadon/radar/sounds/radar.ogg' + start_length = 150 + mid_sounds = list('mod_celadon/radar/sounds/radar.ogg'=10) + mid_length = 150 + end_sound = 'mod_celadon/radar/sounds/radar.ogg' + volume = 90 + var/started = FALSE + +/obj/item/circuitboard/machine/space_radar + name = "RADAR (Machine Board)" + icon_state = "security" + build_path = /obj/machinery/space_radar + req_components = list( + /obj/item/stock_parts/scanning_module = 1, + /obj/item/stock_parts/manipulator = 1, + /obj/item/stock_parts/micro_laser = 1, + /obj/item/stack/cable_coil = 2) + needs_anchored = TRUE + +/obj/machinery/space_radar + name = "RADAR" + desc = "Views everything with rays." + icon = 'mod_celadon/radar/icons/radar.dmi' + icon_state = "radar-off" + layer = BELOW_OBJ_LAYER + density = TRUE + use_power = ACTIVE_POWER_USE + idle_power_usage = IDLE_DRAW_MINIMAL + active_power_usage = ACTIVE_DRAW_MEDIUM + circuit = /obj/item/circuitboard/machine/space_radar + var/efficiency = 0 + var/datum/looping_sound/space_radar/soundloop + var/datum/overmap/ship/controlled/current_ship + +/obj/machinery/space_radar/proc/check_outside() + for(var/turf/T in range(1, get_turf(src))) + if(get_area(T) != get_area(src)) + return TRUE + return FALSE + +/obj/machinery/space_radar/proc/reload_ship() + var/obj/docking_port/mobile/port = SSshuttle.get_containing_shuttle(src) + if(port?.current_ship) + if(current_ship && current_ship != port.current_ship) + current_ship.radars -= src + current_ship = port.current_ship + current_ship.radars |= src + +/obj/machinery/space_radar/Initialize() + . = ..() + soundloop = new(list(src), FALSE) + reload_ship() + if(current_ship) + current_ship.recalculate_radars() + +/obj/machinery/space_radar/Destroy() + QDEL_NULL(soundloop) + if(current_ship) + current_ship.radars -= src + current_ship.recalculate_radars() + . = ..() + +/obj/machinery/space_radar/RefreshParts() + efficiency = 0 + for(var/obj/item/stock_parts/M in component_parts) + efficiency += M.rating + update_icon_state() + ..() + +/obj/machinery/space_radar/update_icon_state() + if(panel_open) + icon_state = "radar-open" + efficiency = -4 + if(soundloop.started) + soundloop.started = FALSE + soundloop.stop() + current_ship.recalculate_radars() + return ..() + else if(is_operational && check_outside()) + icon_state = "radar-on" + if(!soundloop.started) + soundloop.started = TRUE + soundloop.start() + current_ship.recalculate_radars() + return ..() + else + icon_state = "radar-off" + efficiency = -4 + if(soundloop.started) + soundloop.started = FALSE + soundloop.stop() + current_ship.recalculate_radars() + return ..() + +/obj/machinery/space_radar/attackby(obj/item/I, mob/user, params) + if(default_deconstruction_screwdriver(user, icon_state, icon_state, I)) + update_appearance() + return ..() + if(default_deconstruction_crowbar(I)) + return ..() + update_appearance() diff --git a/mod_celadon/radar/icons/radar.dmi b/mod_celadon/radar/icons/radar.dmi new file mode 100644 index 000000000000..f1bc4b53d7ac Binary files /dev/null and b/mod_celadon/radar/icons/radar.dmi differ diff --git a/mod_celadon/radar/sounds/radar.ogg b/mod_celadon/radar/sounds/radar.ogg new file mode 100644 index 000000000000..64939833bc62 Binary files /dev/null and b/mod_celadon/radar/sounds/radar.ogg differ