Skip to content

Commit

Permalink
апывапавы
Browse files Browse the repository at this point in the history
  • Loading branch information
Anorak2024 committed Nov 19, 2024
1 parent 5bdd9fe commit eb8f375
Show file tree
Hide file tree
Showing 30 changed files with 820 additions and 261 deletions.
35 changes: 29 additions & 6 deletions code/__DEFINES/anomalies.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,24 @@
#define iscoret2(A) (istype((A), /obj/item/assembly/signaler/anomaly/tier2))
#define iscoret3(A) (istype((A), /obj/item/assembly/signaler/anomaly/tier3))

#define iscoreempty(A) (type in list(/obj/item/assembly/signaler/anomaly/tier1, /obj/item/assembly/signaler/anomaly/tier2, /obj/item/assembly/signaler/anomaly/tier3))
#define iscoreatmos(A) (type in list(/obj/item/assembly/signaler/anomaly/tier1/pyro, /obj/item/assembly/signaler/anomaly/tier2/pyro, /obj/item/assembly/signaler/anomaly/tier3/pyro))
#define iscorebluespace(A) (type in list(/obj/item/assembly/signaler/anomaly/tier1/bluespace, /obj/item/assembly/signaler/anomaly/tier2/bluespace, /obj/item/assembly/signaler/anomaly/tier3/bluespace))
#define iscoregrav(A) (type in list(/obj/item/assembly/signaler/anomaly/tier1/grav, /obj/item/assembly/signaler/anomaly/tier2/grav, /obj/item/assembly/signaler/anomaly/tier3/grav))
#define iscorevortex(A) (type in list(/obj/item/assembly/signaler/anomaly/tier1/vortex, /obj/item/assembly/signaler/anomaly/tier2/vortex, /obj/item/assembly/signaler/anomaly/tier3/vortex))
#define iscoreflux(A) (type in list(/obj/item/assembly/signaler/anomaly/tier1/flux, /obj/item/assembly/signaler/anomaly/tier2/flux, /obj/item/assembly/signaler/anomaly/tier3/flux))
#define iscoreempty(A) ((A.type == /obj/item/assembly/signaler/anomaly/tier1) || \
(A.type == /obj/item/assembly/signaler/anomaly/tier2) || \
(A.type == /obj/item/assembly/signaler/anomaly/tier3))
#define iscoreatmos(A) ((A.type == /obj/item/assembly/signaler/anomaly/tier1/pyro) || \
(A.type == /obj/item/assembly/signaler/anomaly/tier2/pyro) || \
(A.type == /obj/item/assembly/signaler/anomaly/tier3/pyro))
#define iscorebluespace(A) ((A.type == /obj/item/assembly/signaler/anomaly/tier1/bluespace) || \
(A.type == /obj/item/assembly/signaler/anomaly/tier2/bluespace) || \
(A.type == /obj/item/assembly/signaler/anomaly/tier3/bluespace))
#define iscoregrav(A) ((A.type == /obj/item/assembly/signaler/anomaly/tier1/grav) || \
(A.type == /obj/item/assembly/signaler/anomaly/tier2/grav) || \
(A.type == /obj/item/assembly/signaler/anomaly/tier3/grav))
#define iscorevortex(A) ((A.type == /obj/item/assembly/signaler/anomaly/tier1/vortex) || \
(A.type == /obj/item/assembly/signaler/anomaly/tier2/vortex) || \
(A.type == /obj/item/assembly/signaler/anomaly/tier3/vortex))
#define iscoreflux(A) ((A.type == /obj/item/assembly/signaler/anomaly/tier1/flux) || \
(A.type == /obj/item/assembly/signaler/anomaly/tier2/flux) || \
(A.type == /obj/item/assembly/signaler/anomaly/tier3/flux))

GLOBAL_LIST_INIT(anomaly_types, list(
"1" = list(
Expand All @@ -42,3 +54,14 @@ GLOBAL_LIST_INIT(anomaly_types, list(
ANOMALY_TYPE_FLUX = /obj/item/assembly/signaler/anomaly/tier3/flux,
),
))

GLOBAL_LIST_INIT(created_anomalies, list(
ANOMALY_TYPE_ATMOS = 0,
ANOMALY_TYPE_BLUESPACE = 0,
ANOMALY_TYPE_GRAV = 0,
ANOMALY_TYPE_VORTEX = 0,
ANOMALY_TYPE_FLUX = 0,
))

#define ANOMALY_GROW_STABILITY 30
#define ANOMALY_DECREASE_STABILITY 70
2 changes: 1 addition & 1 deletion code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@
update_icon()
return TRUE

/atom/movable/proc/random_throw(range_low, range_high, speed)
/atom/movable/proc/random_throw(range_low = 0, range_high = 5, speed = 4)
var/list/turf/targets = list()
for(var/turf/T in range(range_high, src))
if(get_dist(T, src) >= range_low && get_dist(T, src) <= range_high)
Expand Down
2 changes: 1 addition & 1 deletion code/game/mecha/mecha_parts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@

/obj/item/mecha_parts/chassis/phazon/attackby(obj/item/I, mob/user, params)
. = ..()
if(istype(I, /obj/item/assembly/signaler/anomaly) && !istype(I, /obj/item/assembly/signaler/anomaly/tier2/bluespace))
if(iscore(I) && !iscorebluespace(I))
to_chat(user, span_warning("The anomaly core socket only accepts bluespace anomaly cores!"))


Expand Down
159 changes: 136 additions & 23 deletions code/game/objects/items/weapons/tuned_anomalous_teleporter.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
/obj/item/tuned_anomalous_teleporter
/obj/item/assembly/tuned_anomalous_teleporter
name = "tuned anomalous teleporter"
desc = "A portable item using blue-space technology."
ru_names = list(NOMINATIVE = "настраеваемый аномальный телепортер", \
GENITIVE = "настраеваемого аномального телепортера", \
DATIVE = "настраеваемому аномальному телепортеру", \
ACCUSATIVE = "настраеваемый аномальный телепортер", \
INSTRUMENTAL = "настраеваемым аномальным телепортером", \
PREPOSITIONAL = "настраеваемом аномальном телепортере")
desc = "Протативный настраиваемый телепортер использующий ядро блюспейс аномалии для телепортации пользователя в \
выбранном направлении."
icon = 'icons/obj/weapons/techrelic.dmi'
icon_state = "teleport"
lefthand_file = 'icons/mob/inhands/relics_production/inhandl.dmi'
Expand All @@ -14,58 +21,164 @@
origin_tech = "magnets=3;bluespace=4"
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 30, BIO = 0, RAD = 0, FIRE = 100, ACID = 100)
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF
origin_tech = "bluespace=5"
gender = MALE

/// Inserted bluespace anomaly core.
var/obj/item/assembly/signaler/anomaly/core = null
/// Variable contains next time hand tele can be used to make it not EMP proof
var/emp_timer = 0
COOLDOWN_DECLARE(tuned_anomalous_teleporter_cooldown) // declare cooldown for teleportations
COOLDOWN_DECLARE(emp_cooldown) // declare cooldown for EMP
var/base_cooldown = 20 SECONDS // cooldown for teleportations
/// Cooldown for teleportations.
var/base_cooldown = 20 SECONDS
/// Minimum waiting time after EMP.
var/emp_cooldown_min = 10 SECONDS // min cooldown for emp
/// Maximum waiting time after EMP.
var/emp_cooldown_max = 15 SECONDS // max cooldown for emp
var/tp_range = 5 // range of teleportations
origin_tech = "bluespace=5"
/// Selected range of teleportations.
var/tp_range = 0
/// Max allowed range of teleportations.
var/max_tp_range = 0

COOLDOWN_DECLARE(tuned_anomalous_teleporter_cooldown) // declare cooldown for teleportations
COOLDOWN_DECLARE(emp_cooldown) // declare cooldown for EMP

/obj/item/assembly/tuned_anomalous_teleporter/Initialize(mapload)
. = ..()
update_core()

/obj/item/assembly/tuned_anomalous_teleporter/activate(mob/user)
if(max_tp_range < 5)
if(user)
to_chat(user, span_warning("[declent_ru(NOMINATIVE)] не может вас телепортировать, \
из-за отсутствия достаточно сильного ядра."))
return

/obj/item/tuned_anomalous_teleporter/attack_self(mob/user)
if(!COOLDOWN_FINISHED(src, emp_cooldown))
do_sparks(5, FALSE, loc)
to_chat(user, span_warning("[src] attempts to teleport you, but abruptly shuts off."))
return FALSE
if(user)
to_chat(user, span_warning("[declent_ru(NOMINATIVE)] не может вас телепортировать, \
из-за того, что он временно выведен из строя."))

return

if(!COOLDOWN_FINISHED(src, tuned_anomalous_teleporter_cooldown))
to_chat(user, span_warning("[src] is still recharging."))
return FALSE
if(user)
to_chat(user, span_warning("[declent_ru(NOMINATIVE)] все еще перезаряжается."))

return

var/atom/tp_target = src
if(user)
tp_target = user
else
while(!isturf(tp_target.loc))
tp_target = tp_target.loc

COOLDOWN_START(src, tuned_anomalous_teleporter_cooldown, base_cooldown)

var/datum/teleport/TP = new /datum/teleport()
var/crossdir = angle2dir((dir2angle(user.dir)) % 360)
var/turf/T1 = get_turf(user)
var/crossdir = angle2dir((dir2angle(tp_target.dir)) % 360)
var/turf/T1 = get_turf(tp_target)
for(var/i in 1 to tp_range)
T1 = get_step(T1, crossdir)

var/datum/effect_system/smoke_spread/s1 = new
var/datum/effect_system/smoke_spread/s2 = new
s1.set_up(5, FALSE, user)
s2.set_up(5, FALSE, user)
TP.start(user, T1, FALSE, TRUE, s1, s2, 'sound/effects/phasein.ogg', )
s1.set_up(5, FALSE, tp_target)
s2.set_up(5, FALSE, tp_target)
TP.start(tp_target, T1, FALSE, TRUE, s1, s2, 'sound/effects/phasein.ogg', )
TP.doTeleport()

/obj/item/tuned_anomalous_teleporter/emp_act(severity)
/obj/item/assembly/tuned_anomalous_teleporter/attack_self(mob/user)
activate(user)

/obj/item/assembly/tuned_anomalous_teleporter/emp_act(severity)
make_inactive(severity)
return ..()

/obj/item/tuned_anomalous_teleporter/proc/make_inactive(severity)
/obj/item/assembly/tuned_anomalous_teleporter/proc/make_inactive(severity)
var/time = rand(emp_cooldown_min, emp_cooldown_max) * (severity == EMP_HEAVY ? 2 : 1)
COOLDOWN_START(src, emp_cooldown, time)

/obj/item/tuned_anomalous_teleporter/examine(mob/user)
/obj/item/assembly/tuned_anomalous_teleporter/examine(mob/user)
. = ..()
if(emp_timer > world.time)
. += span_warning("It looks inactive.")
. += span_warning("[declent_ru(NOMINATIVE)] выглядит неработающим.")

/obj/item/assembly/tuned_anomalous_teleporter/AltClick(mob/user)
if(!user.contains(src))
return

if(!core)
user.balloon_alert(user, "нет ядра")
return

user.put_in_active_hand(core)
core = null
user.balloon_alert(user, "ядро извлечено")
update_core()

/obj/item/assembly/tuned_anomalous_teleporter/attackby(obj/item/I, mob/user, params)
if(!iscorebluespace(I))
return ..()

add_fingerprint(user)
var/msg = "ядро вставлено"
if(core)
user.put_in_hands(core)
msg = "ядро заменено"

if(!user.drop_transfer_item_to_loc(I, src))
user.balloon_alert(user, "не отпустить")
return

core = I
user.balloon_alert(user, msg)
update_core()
return ATTACK_CHAIN_PROCEED

/obj/item/assembly/tuned_anomalous_teleporter/attack_hand(mob/user, pickupfireoverride)
if(!core || !user.is_in_hands(src))
return ..()

add_fingerprint(user)
if(max_tp_range < 5)
to_chat(user, span_warning("В [declent_ru(PREPOSITIONAL)] нет ядра, достаточно сильного, для телепортации."))
return

var/new_range = tgui_input_number(user, "Выберите дистанцию телепортации", "Настройка телепортера", tp_range, max_tp_range, 1)
if(!new_range)
return

if(get_dist(user, src) > 1)
user.balloon_alert(user, "слишком далеко")
return

tp_range = clamp(new_range, 1, max_tp_range)
user.balloon_alert(user, "выбрана дистанция [tp_range]")

/*
Ranges with core charge 50-100:
tier1 - 1-3 (to weak for any)
tier2 - 3-7
tier3 - 7-10
*/
/obj/item/assembly/tuned_anomalous_teleporter/proc/update_core()
if(!core)
max_tp_range = 0
tp_range = 0
return

var/old_max_tp_range = max_tp_range
max_tp_range = max(1, round((core.get_strenght() + 10) / 30))
if(tp_range != old_max_tp_range) // If was max, set max, else leave old.
tp_range = max_tp_range

/datum/crafting_recipe/tuned_anomalous_teleporter
name = "Tuned anomalous teleporter"
result = /obj/item/tuned_anomalous_teleporter
result = /obj/item/assembly/tuned_anomalous_teleporter
tools = list(TOOL_SCREWDRIVER, TOOL_WELDER)
reqs = list(/obj/item/relict_production/strange_teleporter = 1,
/obj/item/assembly/signaler/anomaly/tier2/bluespace = 1,
/obj/item/gps = 1,
/obj/item/stack/ore/bluespace_crystal,
/obj/item/stack/sheet/metal = 2,
Expand Down
Loading

0 comments on commit eb8f375

Please sign in to comment.