diff --git a/code/datums/actions/action.dm b/code/datums/actions/action.dm
index 69f8fd42dcf..75c9cf59aeb 100644
--- a/code/datums/actions/action.dm
+++ b/code/datums/actions/action.dm
@@ -46,6 +46,8 @@
var/overlay_icon = 'icons/mob/actions/backgrounds.dmi'
/// This is the icon state for any FOREGROUND overlay icons on the button (such as borders)
var/overlay_icon_state
+ /// Toggles whether this action is usable or not
+ var/action_disabled = FALSE
/datum/action/New(Target)
link_to(Target)
@@ -162,6 +164,8 @@
/datum/action/proc/IsAvailable(feedback = FALSE)
if(!owner)
return FALSE
+ if(action_disabled)
+ return FALSE
if((check_flags & AB_CHECK_HANDS_BLOCKED) && HAS_TRAIT(owner, TRAIT_HANDS_BLOCKED))
if (feedback)
owner.balloon_alert(owner, "hands blocked!")
diff --git a/code/datums/actions/cooldown_action.dm b/code/datums/actions/cooldown_action.dm
index cb0d665a5cb..18fe9f22e80 100644
--- a/code/datums/actions/cooldown_action.dm
+++ b/code/datums/actions/cooldown_action.dm
@@ -187,6 +187,31 @@
else
shared_ability.StartCooldownSelf(cooldown_time)
+/// Resets the cooldown of this ability
+/datum/action/cooldown/proc/ResetCooldown()
+ next_use_time = world.time
+ build_all_button_icons(UPDATE_BUTTON_STATUS)
+
+/// Re-enables this cooldown action
+/datum/action/cooldown/proc/enable()
+ action_disabled = FALSE
+ build_all_button_icons(UPDATE_BUTTON_STATUS)
+
+/// Disables this cooldown action
+/datum/action/cooldown/proc/disable()
+ action_disabled = TRUE
+ build_all_button_icons(UPDATE_BUTTON_STATUS)
+
+/// Re-enables all cooldown actions
+/datum/action/cooldown/proc/enable_cooldown_actions()
+ for(var/datum/action/cooldown/cd_action in owner.actions)
+ cd_action.enable()
+
+/// Disables all cooldown actions
+/datum/action/cooldown/proc/disable_cooldown_actions()
+ for(var/datum/action/cooldown/cd_action in owner.actions)
+ cd_action.disable()
+
/datum/action/cooldown/Trigger(trigger_flags, atom/target)
. = ..()
if(!.)
diff --git a/code/datums/actions/mobs/blood_warp.dm b/code/datums/actions/mobs/blood_warp.dm
index 823f756d7af..8503b360954 100644
--- a/code/datums/actions/mobs/blood_warp.dm
+++ b/code/datums/actions/mobs/blood_warp.dm
@@ -12,8 +12,10 @@
var/remove_inner_pools = TRUE
/datum/action/cooldown/mob_cooldown/blood_warp/Activate(atom/target_atom)
+ disable_cooldown_actions()
blood_warp(target_atom)
StartCooldown()
+ enable_cooldown_actions()
return TRUE
/datum/action/cooldown/mob_cooldown/blood_warp/proc/blood_warp(atom/target)
diff --git a/code/datums/actions/mobs/charge.dm b/code/datums/actions/mobs/charge.dm
index c1ff66dcfa9..9b8e1c36ef8 100644
--- a/code/datums/actions/mobs/charge.dm
+++ b/code/datums/actions/mobs/charge.dm
@@ -22,9 +22,10 @@
var/list/charging = list()
/datum/action/cooldown/mob_cooldown/charge/Activate(atom/target_atom)
- StartCooldown(360 SECONDS, 360 SECONDS)
+ disable_cooldown_actions()
charge_sequence(owner, target_atom, charge_delay, charge_past)
StartCooldown()
+ enable_cooldown_actions()
return TRUE
/datum/action/cooldown/mob_cooldown/charge/proc/charge_sequence(atom/movable/charger, atom/target_atom, delay, past)
diff --git a/code/datums/actions/mobs/chase_target.dm b/code/datums/actions/mobs/chase_target.dm
new file mode 100644
index 00000000000..c88285dd636
--- /dev/null
+++ b/code/datums/actions/mobs/chase_target.dm
@@ -0,0 +1,42 @@
+/datum/action/cooldown/mob_cooldown/chase_target
+ name = "Chase Target"
+ button_icon = 'icons/mob/actions/actions_items.dmi'
+ button_icon_state = "sniper_zoom"
+ desc = "Gain a burst of speed to chase down a target."
+ cooldown_time = 6 SECONDS
+ /// Affects volume of the charge tell depending on the size of the mob charging
+ var/size = 1
+
+/datum/action/cooldown/mob_cooldown/chase_target/Activate(atom/target_atom)
+ disable_cooldown_actions()
+ charge(target_atom)
+ StartCooldown()
+ enable_cooldown_actions()
+ return TRUE
+
+/// Causes the mob to gain speed and charge at a target
+/datum/action/cooldown/mob_cooldown/chase_target/proc/charge(atom/target)
+ var/mob/living/living_mob = target
+ if(istype(living_mob) && living_mob.stat == DEAD)
+ return
+ owner.visible_message(span_boldwarning("[owner] charges!"))
+ owner.SpinAnimation(speed = 20, loops = 3, parallel = FALSE)
+ if(ishostile(owner))
+ var/mob/living/simple_animal/hostile/hostile_mob = owner
+ hostile_mob.retreat_distance = 0
+ hostile_mob.minimum_distance = 0
+ hostile_mob.set_varspeed(0)
+ addtimer(CALLBACK(src, PROC_REF(reset_charge)), 6 SECONDS)
+ addtimer(CALLBACK(src, PROC_REF(throw_thyself)), 2 SECONDS)
+
+/// This is the proc that actually does the throwing. Charge only adds a timer for this.
+/datum/action/cooldown/mob_cooldown/chase_target/proc/throw_thyself()
+ playsound(owner, 'sound/weapons/sonic_jackhammer.ogg', 50, TRUE)
+ owner.throw_at(target, 7, 1.1, owner, FALSE, FALSE, CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(playsound), owner, 'sound/effects/meteorimpact.ogg', 50 * size, TRUE, 2), INFINITY)
+
+/// Resets the charge buffs.
+/datum/action/cooldown/mob_cooldown/chase_target/proc/reset_charge()
+ var/mob/living/simple_animal/hostile/hostile_mob = owner
+ hostile_mob.retreat_distance = 5
+ hostile_mob.minimum_distance = 5
+ hostile_mob.set_varspeed(2)
diff --git a/code/datums/actions/mobs/create_legion_skull.dm b/code/datums/actions/mobs/create_legion_skull.dm
new file mode 100644
index 00000000000..341ef2d8203
--- /dev/null
+++ b/code/datums/actions/mobs/create_legion_skull.dm
@@ -0,0 +1,19 @@
+/datum/action/cooldown/mob_cooldown/create_legion_skull
+ name = "Create Legion Skull"
+ button_icon = 'icons/mob/simple/lavaland/lavaland_monsters.dmi'
+ button_icon_state = "legion_head"
+ desc = "Create a legion skull to chase down a targeted enemy"
+ cooldown_time = 2 SECONDS
+
+/datum/action/cooldown/mob_cooldown/create_legion_skull/Activate(atom/target_atom)
+ disable_cooldown_actions()
+ create(target_atom)
+ StartCooldown()
+ enable_cooldown_actions()
+ return TRUE
+
+/// Creates a new skull assigned to the owner of this action
+/datum/action/cooldown/mob_cooldown/create_legion_skull/proc/create(atom/target)
+ var/mob/living/basic/legion_brood/minion = new(owner.loc)
+ minion.assign_creator(owner)
+ minion.ai_controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET] = target
diff --git a/code/datums/actions/mobs/create_legion_turrets.dm b/code/datums/actions/mobs/create_legion_turrets.dm
new file mode 100644
index 00000000000..5fb668ebc36
--- /dev/null
+++ b/code/datums/actions/mobs/create_legion_turrets.dm
@@ -0,0 +1,116 @@
+/datum/action/cooldown/mob_cooldown/create_legion_turrets
+ name = "Create Sentinels"
+ button_icon = 'icons/mob/simple/lavaland/lavaland_monsters.dmi'
+ button_icon_state = "legion_turret"
+ desc = "Create legion sentinels that fire at any enemies."
+ cooldown_time = 2 SECONDS
+ /// Minimum number of turrets that can be spawned
+ var/minimum_turrets = 2
+ /// Maximum number of turrets that can be spawned
+ var/maximum_turrets = 2
+
+/datum/action/cooldown/mob_cooldown/create_legion_turrets/Activate(atom/target_atom)
+ disable_cooldown_actions()
+ create(target_atom)
+ StartCooldown()
+ enable_cooldown_actions()
+ return TRUE
+
+/// Creates new legion turrets around the owner between the minimum and maximum
+/datum/action/cooldown/mob_cooldown/create_legion_turrets/proc/create(atom/target)
+ playsound(owner, 'sound/magic/RATTLEMEBONES.ogg', 100, TRUE)
+ var/list/possible_locations = list()
+ for(var/turf/checked_turf in oview(owner, 4)) //Only place the turrets on open turfs
+ if(checked_turf.is_blocked_turf())
+ continue
+ possible_locations += checked_turf
+ for(var/i in 1 to min(rand(minimum_turrets, maximum_turrets), length(possible_locations))) //Makes sure aren't spawning in nullspace.
+ var/chosen = pick_n_take(possible_locations)
+ new /obj/structure/legionturret(chosen)
+
+/// A basic turret that shoots at nearby mobs. Intended to be used for the legion megafauna.
+/obj/structure/legionturret
+ name = "\improper Legion sentinel"
+ desc = "The eye pierces your soul."
+ icon = 'icons/mob/simple/lavaland/lavaland_monsters.dmi'
+ icon_state = "legion_turret"
+ light_power = 0.5
+ light_range = 2
+ max_integrity = 80
+ luminosity = 6
+ anchored = TRUE
+ density = TRUE
+ layer = ABOVE_OBJ_LAYER
+ armor_type = /datum/armor/structure_legionturret
+ //Compared with the targeted mobs. If they have the faction, turret won't shoot.
+ faction = list(FACTION_MINING)
+ ///What kind of projectile the actual damaging part should be.
+ var/projectile_type = /obj/projectile/beam/legion
+ ///Time until the tracer gets shot
+ var/initial_firing_time = 1.8 SECONDS
+ ///How long it takes between shooting the tracer and the projectile.
+ var/shot_delay = 0.8 SECONDS
+
+/datum/armor/structure_legionturret
+ laser = 100
+
+/obj/structure/legionturret/Initialize(mapload)
+ . = ..()
+ addtimer(CALLBACK(src, PROC_REF(set_up_shot)), initial_firing_time)
+ ADD_TRAIT(src, TRAIT_NO_FLOATING_ANIM, INNATE_TRAIT)
+
+/// Handles an extremely basic AI
+/obj/structure/legionturret/proc/set_up_shot()
+ for(var/mob/living/possible_target in oview(9, src))
+ if(possible_target.stat == DEAD || possible_target.stat == UNCONSCIOUS)
+ continue
+ if(faction_check(faction, possible_target.faction))
+ continue
+ fire(possible_target)
+ return
+ fire(get_edge_target_turf(src, pick(GLOB.cardinals)))
+
+/// Called when attacking a target. Shoots a projectile at the turf underneath the target.
+/obj/structure/legionturret/proc/fire(atom/target)
+ var/turf/target_turf = get_turf(target)
+ var/turf/our_turf = get_turf(src)
+ if(!target_turf || !our_turf)
+ return
+ //Now we generate the tracer.
+ var/angle = get_angle(our_turf, target_turf)
+ var/datum/point/vector/V = new(our_turf.x, our_turf.y, our_turf.z, 0, 0, angle)
+ generate_tracer_between_points(V, V.return_vector_after_increments(6), /obj/effect/projectile/tracer/legion/tracer, 0, shot_delay, 0, 0, 0, null)
+ playsound(src, 'sound/machines/airlockopen.ogg', 100, TRUE)
+ addtimer(CALLBACK(src, PROC_REF(fire_beam), angle), shot_delay)
+
+/// Called shot_delay after the turret shot the tracer. Shoots a projectile into the same direction.
+/obj/structure/legionturret/proc/fire_beam(angle)
+ var/obj/projectile/ouchie = new projectile_type(loc)
+ ouchie.firer = src
+ ouchie.fire(angle)
+ playsound(src, 'sound/effects/bin_close.ogg', 100, TRUE)
+ QDEL_IN(src, 0.5 SECONDS)
+
+/// Used for the legion turret.
+/obj/projectile/beam/legion
+ name = "blood pulse"
+ hitsound = 'sound/magic/magic_missile.ogg'
+ damage = 19
+ range = 6
+ light_color = COLOR_SOFT_RED
+ impact_effect_type = /obj/effect/temp_visual/kinetic_blast
+ tracer_type = /obj/effect/projectile/tracer/legion
+ muzzle_type = /obj/effect/projectile/tracer/legion
+ impact_type = /obj/effect/projectile/tracer/legion
+ hitscan = TRUE
+ projectile_piercing = ALL
+
+/// Used for the legion turret tracer.
+/obj/effect/projectile/tracer/legion/tracer
+ icon = 'icons/effects/beam.dmi'
+ icon_state = "blood_light"
+
+/// Used for the legion turret beam.
+/obj/effect/projectile/tracer/legion
+ icon = 'icons/effects/beam.dmi'
+ icon_state = "blood"
diff --git a/code/datums/actions/mobs/dash.dm b/code/datums/actions/mobs/dash.dm
index ddb814eb24f..81d6f8165d9 100644
--- a/code/datums/actions/mobs/dash.dm
+++ b/code/datums/actions/mobs/dash.dm
@@ -10,9 +10,10 @@
var/pick_range = 5
/datum/action/cooldown/mob_cooldown/dash/Activate(atom/target_atom)
- StartCooldown(360 SECONDS, 360 SECONDS)
+ disable_cooldown_actions()
dash_to(target_atom)
StartCooldown()
+ enable_cooldown_actions()
return TRUE
/datum/action/cooldown/mob_cooldown/dash/proc/dash_to(atom/dash_target)
diff --git a/code/datums/actions/mobs/lava_swoop.dm b/code/datums/actions/mobs/lava_swoop.dm
index a5acc29bab6..b86a710fbf2 100644
--- a/code/datums/actions/mobs/lava_swoop.dm
+++ b/code/datums/actions/mobs/lava_swoop.dm
@@ -21,9 +21,10 @@
M.remove_traits(list(TRAIT_LAVA_IMMUNE, TRAIT_NOFIRE), REF(src))
/datum/action/cooldown/mob_cooldown/lava_swoop/Activate(atom/target_atom)
- StartCooldown(360 SECONDS, 360 SECONDS)
+ disable_cooldown_actions()
attack_sequence(target_atom)
StartCooldown()
+ enable_cooldown_actions()
return TRUE
/datum/action/cooldown/mob_cooldown/lava_swoop/proc/attack_sequence(atom/target)
diff --git a/code/datums/actions/mobs/meteors.dm b/code/datums/actions/mobs/meteors.dm
index 0c95b6c8e17..11cdac43864 100644
--- a/code/datums/actions/mobs/meteors.dm
+++ b/code/datums/actions/mobs/meteors.dm
@@ -6,9 +6,10 @@
cooldown_time = 3 SECONDS
/datum/action/cooldown/mob_cooldown/meteors/Activate(atom/target_atom)
- StartCooldown(360 SECONDS, 360 SECONDS)
+ disable_cooldown_actions()
create_meteors(target_atom)
StartCooldown()
+ enable_cooldown_actions()
return TRUE
/datum/action/cooldown/mob_cooldown/meteors/proc/create_meteors(atom/target)
diff --git a/code/datums/actions/mobs/projectileattack.dm b/code/datums/actions/mobs/projectileattack.dm
index 19d0d9f076c..be7eff89633 100644
--- a/code/datums/actions/mobs/projectileattack.dm
+++ b/code/datums/actions/mobs/projectileattack.dm
@@ -18,9 +18,10 @@
var/projectile_speed_multiplier = 1
/datum/action/cooldown/mob_cooldown/projectile_attack/Activate(atom/target_atom)
- StartCooldown(360 SECONDS, 360 SECONDS)
+ disable_cooldown_actions()
attack_sequence(owner, target_atom)
StartCooldown()
+ enable_cooldown_actions()
return TRUE
/datum/action/cooldown/mob_cooldown/projectile_attack/proc/attack_sequence(mob/living/firer, atom/target)
diff --git a/code/datums/actions/mobs/transform_weapon.dm b/code/datums/actions/mobs/transform_weapon.dm
index 3abeed5dfbf..b268fac6414 100644
--- a/code/datums/actions/mobs/transform_weapon.dm
+++ b/code/datums/actions/mobs/transform_weapon.dm
@@ -9,9 +9,10 @@
var/max_cooldown_time = 10 SECONDS
/datum/action/cooldown/mob_cooldown/transform_weapon/Activate(atom/target_atom)
- StartCooldown(360 SECONDS, 360 SECONDS)
+ disable_cooldown_actions()
do_transform(target_atom)
StartCooldown(rand(cooldown_time, max_cooldown_time), 0)
+ enable_cooldown_actions()
return TRUE
/datum/action/cooldown/mob_cooldown/transform_weapon/proc/do_transform(atom/target)
diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/legion.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/legion.dm
index eda344ad1da..5077b3781e6 100644
--- a/code/modules/mob/living/simple_animal/hostile/megafauna/legion.dm
+++ b/code/modules/mob/living/simple_animal/hostile/megafauna/legion.dm
@@ -57,15 +57,31 @@
elimination = TRUE
appearance_flags = LONG_GLIDE
mouse_opacity = MOUSE_OPACITY_ICON
- attack_action_types = list(/datum/action/innate/megafauna_attack/create_skull,
- /datum/action/innate/megafauna_attack/charge_target,
- /datum/action/innate/megafauna_attack/create_turrets)
var/size = LEGION_LARGE
- var/charging = FALSE
+ /// Create Skulls ability
+ var/datum/action/cooldown/mob_cooldown/create_legion_skull/create_legion_skull
+ /// Charge Target Ability
+ var/datum/action/cooldown/mob_cooldown/chase_target/chase_target
+ /// Create Turrets Ability
+ var/datum/action/cooldown/mob_cooldown/create_legion_turrets/create_legion_turrets
/mob/living/simple_animal/hostile/megafauna/legion/Initialize(mapload)
. = ..()
ADD_TRAIT(src, TRAIT_NO_FLOATING_ANIM, INNATE_TRAIT)
+ create_legion_skull = new(src)
+ chase_target = new(src)
+ chase_target.size = size
+ create_legion_turrets = new(src)
+ create_legion_turrets.maximum_turrets = size * 2
+ create_legion_skull.Grant(src)
+ chase_target.Grant(src)
+ create_legion_turrets.Grant(src)
+
+/mob/living/simple_animal/hostile/megafauna/legion/Destroy()
+ create_legion_skull = null
+ chase_target = null
+ create_legion_turrets = null
+ return ..()
/mob/living/simple_animal/hostile/megafauna/legion/medium
icon = 'icons/mob/simple/lavaland/64x64megafauna.dmi'
@@ -91,80 +107,17 @@
maxHealth = 200
size = LEGION_SMALL
-
-
-/datum/action/innate/megafauna_attack/create_skull
- name = "Create Legion Skull"
- button_icon = 'icons/mob/simple/lavaland/lavaland_monsters.dmi'
- button_icon_state = "legion_head"
- chosen_message = "You are now creating legion skulls."
- chosen_attack_num = 1
-
-/datum/action/innate/megafauna_attack/charge_target
- name = "Charge Target"
- button_icon = 'icons/mob/actions/actions_items.dmi'
- button_icon_state = "sniper_zoom"
- chosen_message = "You are now charging at your target."
- chosen_attack_num = 2
-
-/datum/action/innate/megafauna_attack/create_turrets
- name = "Create Sentinels"
- button_icon = 'icons/mob/simple/lavaland/lavaland_monsters.dmi'
- button_icon_state = "legion_turret"
- chosen_message = "You are now creating legion sentinels."
- chosen_attack_num = 3
-
/mob/living/simple_animal/hostile/megafauna/legion/OpenFire(the_target)
- if(charging)
- return
- update_cooldowns(list(COOLDOWN_UPDATE_SET_RANGED = ranged_cooldown_time), ignore_staggered = TRUE)
-
if(client)
- switch(chosen_attack)
- if(1)
- create_legion_skull()
- if(2)
- charge_target()
- if(3)
- create_legion_turrets()
return
switch(rand(4)) //Larger skulls use more attacks.
if(0 to 2)
- create_legion_skull()
+ create_legion_skull.Trigger(target = target)
if(3)
- charge_target()
+ chase_target.Trigger(target = target)
if(4)
- create_legion_turrets()
-
-//SKULLS
-
-///Attack proc. Spawns a singular legion skull.
-/mob/living/simple_animal/hostile/megafauna/legion/proc/create_legion_skull()
- var/mob/living/basic/legion_brood/minion = new(loc)
- minion.assign_creator(src)
- minion.ai_controller.blackboard[BB_BASIC_MOB_CURRENT_TARGET] = target
-
-//CHARGE
-
-///Attack proc. Gives legion some movespeed buffs and switches the AI to melee. At lower sizes, this also throws the skull at the player.
-/mob/living/simple_animal/hostile/megafauna/legion/proc/charge_target()
- visible_message(span_warning("[src] charges!"))
- SpinAnimation(speed = 20, loops = 3, parallel = FALSE)
- ranged = FALSE
- retreat_distance = 0
- minimum_distance = 0
- set_varspeed(0)
- charging = TRUE
- addtimer(CALLBACK(src, PROC_REF(reset_charge)), 60)
- var/mob/living/L = target
- if(!istype(L) || L.stat != DEAD) //I know, weird syntax, but it just works.
- addtimer(CALLBACK(src, PROC_REF(throw_thyself)), 20)
-
-///This is the proc that actually does the throwing. Charge only adds a timer for this.
-/mob/living/simple_animal/hostile/megafauna/legion/proc/throw_thyself()
- playsound(src, 'sound/weapons/sonic_jackhammer.ogg', 50, TRUE)
- throw_at(target, 7, 1.1, src, FALSE, FALSE, CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(playsound), src, 'sound/effects/meteorimpact.ogg', 50 * size, TRUE, 2), INFINITY)
+ create_legion_turrets.Trigger(target = target)
///Deals some extra damage on throw impact.
/mob/living/simple_animal/hostile/megafauna/legion/throw_impact(mob/living/hit_atom, datum/thrownthing/throwingdatum)
@@ -174,21 +127,6 @@
hit_atom.apply_damage(22 * size / 2, wound_bonus = CANT_WOUND) //It gets pretty hard to dodge the skulls when there are a lot of them. Scales down with size
hit_atom.safe_throw_at(get_step(src, get_dir(src, hit_atom)), 2) //Some knockback. Prevent the legion from melee directly after the throw.
-//TURRETS
-
-///Attack proc. Creates up to three legion turrets on suitable turfs nearby.
-/mob/living/simple_animal/hostile/megafauna/legion/proc/create_legion_turrets(minimum = 2, maximum = size * 2)
- playsound(src, 'sound/magic/RATTLEMEBONES.ogg', 100, TRUE)
- var/list/possiblelocations = list()
- for(var/turf/T in oview(src, 4)) //Only place the turrets on open turfs
- if(T.is_blocked_turf())
- continue
- possiblelocations += T
- for(var/i in 1 to min(rand(minimum, maximum), LAZYLEN(possiblelocations))) //Makes sure aren't spawning in nullspace.
- var/chosen = pick(possiblelocations)
- new /obj/structure/legionturret(chosen)
- possiblelocations -= chosen
-
/mob/living/simple_animal/hostile/megafauna/legion/GiveTarget(new_target)
. = ..()
if(target)
@@ -212,15 +150,6 @@
var/mob/living/basic/legion_brood/legion = new(loc)
legion.infest(living_target)
-
-///Resets the charge buffs.
-/mob/living/simple_animal/hostile/megafauna/legion/proc/reset_charge()
- ranged = TRUE
- retreat_distance = 5
- minimum_distance = 5
- set_varspeed(2)
- charging = FALSE
-
///Special snowflake death() here. Can only die if size is 1 or lower and HP is 0 or below.
/mob/living/simple_animal/hostile/megafauna/legion/death()
//Make sure we didn't get cheesed
@@ -255,93 +184,6 @@
new /mob/living/simple_animal/hostile/megafauna/legion/medium/right(loc)
new /mob/living/simple_animal/hostile/megafauna/legion/medium/eye(loc)
-///A basic turret that shoots at nearby mobs. Intended to be used for the legion megafauna.
-/obj/structure/legionturret
- name = "\improper Legion sentinel"
- desc = "The eye pierces your soul."
- icon = 'icons/mob/simple/lavaland/lavaland_monsters.dmi'
- icon_state = "legion_turret"
- light_power = 0.5
- light_range = 2
- max_integrity = 80
- luminosity = 6
- anchored = TRUE
- density = TRUE
- layer = ABOVE_OBJ_LAYER
- armor_type = /datum/armor/structure_legionturret
- //Compared with the targeted mobs. If they have the faction, turret won't shoot.
- faction = list(FACTION_MINING)
- ///What kind of projectile the actual damaging part should be.
- var/projectile_type = /obj/projectile/beam/legion
- ///Time until the tracer gets shot
- var/initial_firing_time = 18
- ///How long it takes between shooting the tracer and the projectile.
- var/shot_delay = 8
-
-/datum/armor/structure_legionturret
- laser = 100
-
-/obj/structure/legionturret/Initialize(mapload)
- . = ..()
- addtimer(CALLBACK(src, PROC_REF(set_up_shot)), initial_firing_time)
- ADD_TRAIT(src, TRAIT_NO_FLOATING_ANIM, INNATE_TRAIT)
-
-///Handles an extremely basic AI
-/obj/structure/legionturret/proc/set_up_shot()
- for(var/mob/living/L in oview(9, src))
- if(L.stat == DEAD || L.stat == UNCONSCIOUS)
- continue
- if(faction_check(faction, L.faction))
- continue
- fire(L)
- return
- fire(get_edge_target_turf(src, pick(GLOB.cardinals)))
-
-///Called when attacking a target. Shoots a projectile at the turf underneath the target.
-/obj/structure/legionturret/proc/fire(atom/target)
- var/turf/T = get_turf(target)
- var/turf/T1 = get_turf(src)
- if(!T || !T1)
- return
- //Now we generate the tracer.
- var/angle = get_angle(T1, T)
- var/datum/point/vector/V = new(T1.x, T1.y, T1.z, 0, 0, angle)
- generate_tracer_between_points(V, V.return_vector_after_increments(6), /obj/effect/projectile/tracer/legion/tracer, 0, shot_delay, 0, 0, 0, null)
- playsound(src, 'sound/machines/airlockopen.ogg', 100, TRUE)
- addtimer(CALLBACK(src, PROC_REF(fire_beam), angle), shot_delay)
-
-///Called shot_delay after the turret shot the tracer. Shoots a projectile into the same direction.
-/obj/structure/legionturret/proc/fire_beam(angle)
- var/obj/projectile/ouchie = new projectile_type(loc)
- ouchie.firer = src
- ouchie.fire(angle)
- playsound(src, 'sound/effects/bin_close.ogg', 100, TRUE)
- QDEL_IN(src, 5)
-
-///Used for the legion turret.
-/obj/projectile/beam/legion
- name = "blood pulse"
- hitsound = 'sound/magic/magic_missile.ogg'
- damage = 19
- range = 6
- light_color = COLOR_SOFT_RED
- impact_effect_type = /obj/effect/temp_visual/kinetic_blast
- tracer_type = /obj/effect/projectile/tracer/legion
- muzzle_type = /obj/effect/projectile/tracer/legion
- impact_type = /obj/effect/projectile/tracer/legion
- hitscan = TRUE
- projectile_piercing = ALL
-
-///Used for the legion turret tracer.
-/obj/effect/projectile/tracer/legion/tracer
- icon = 'icons/effects/beam.dmi'
- icon_state = "blood_light"
-
-///Used for the legion turret beam.
-/obj/effect/projectile/tracer/legion
- icon = 'icons/effects/beam.dmi'
- icon_state = "blood"
-
#undef LEGION_LARGE
#undef LEGION_MEDIUM
#undef LEGION_SMALL
diff --git a/tgstation.dme b/tgstation.dme
index 47ec0507cd0..ba2f1d9a0fd 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -934,7 +934,10 @@
#include "code\datums\actions\mobs\blood_warp.dm"
#include "code\datums\actions\mobs\charge.dm"
#include "code\datums\actions\mobs\charge_apc.dm"
+#include "code\datums\actions\mobs\chase_target.dm"
#include "code\datums\actions\mobs\conjure_foamwall.dm"
+#include "code\datums\actions\mobs\create_legion_skull.dm"
+#include "code\datums\actions\mobs\create_legion_turrets.dm"
#include "code\datums\actions\mobs\dash.dm"
#include "code\datums\actions\mobs\defensive_mode.dm"
#include "code\datums\actions\mobs\fire_breath.dm"