Adds Point Defense turrets.

This commit is contained in:
Mechoid
2020-11-24 03:36:59 -08:00
parent 31a81e0f10
commit 8fa749fbe5
8 changed files with 128 additions and 6 deletions

View File

@@ -202,6 +202,21 @@
return
..()
/obj/effect/meteor/bullet_act(var/obj/item/projectile/Proj)
if(Proj.excavation_amount)
get_hit()
if(!QDELETED(src))
wall_power -= Proj.excavation_amount + Proj.damage + (Proj.hitscan * 25) // Instant-impact projectiles are inherently better at dealing with meteors.
wall_power = max(1, wall_power)
if(wall_power < Proj.excavation_amount)
if(prob(min(90, 100 - Proj.damage)))
die(TRUE)
else
die(FALSE)
return
return
/obj/effect/meteor/proc/make_debris()
for(var/throws = dropamt, throws > 0, throws--)
var/obj/item/O = new meteordrop(get_turf(src))

View File

@@ -73,6 +73,7 @@
var/check_anomalies = TRUE //checks if it can shoot at unidentified lifeforms (ie xenos)
var/check_synth = FALSE //if active, will shoot at anything not an AI or cyborg
var/check_all = FALSE //If active, will fire on anything, including synthetics.
var/fire_at_movement = FALSE // If active, will fire on the most recent thing to move in range, as soon as possible.
var/ailock = FALSE // AI cannot use this
var/check_down = FALSE //If active, will shoot to kill when lethals are also on
var/faction = null //if set, will not fire at people in the same faction for any reason.
@@ -93,6 +94,8 @@
var/timeout = 10 // When a turret pops up, then finds nothing to shoot at, this number decrements until 0, when it pops down.
var/can_salvage = TRUE // If false, salvaging doesn't give you anything.
var/stay_up = FALSE // If true, the turret will remain open while it is powered.
/obj/machinery/porta_turret/crescent
req_one_access = list(access_cent_specops)
enabled = FALSE
@@ -300,6 +303,23 @@
return 1
/obj/machinery/porta_turret/pointdefense
name = "point-defense turret"
turret_type = "core"
installation = /obj/item/weapon/gun/energy/mininglaser
check_arrest = FALSE
check_records = FALSE
check_weapons = FALSE
check_access = FALSE
check_anomalies = FALSE
check_synth = FALSE
check_all = FALSE
fire_at_movement = TRUE
ailock = FALSE
check_down = FALSE
/obj/machinery/porta_turret/Initialize()
//Sets up a spark system
spark_system = new /datum/effect/effect/system/spark_spread
@@ -346,6 +366,8 @@
var/obj/item/projectile/P = initial(E.projectile_type)
//var/obj/item/ammo_casing/shottype = E.projectile_type
GLOB.moved_event.register_global(src, /obj/machinery/porta_turret/proc/point_defense)
projectile = P
lethal_projectile = projectile
shot_sound = initial(P.fire_sound)
@@ -401,6 +423,14 @@
lethal_shot_sound = 'sound/weapons/eluger.ogg'
shot_sound = 'sound/weapons/Taser.ogg'
if(/obj/item/weapon/gun/energy/mininglaser)
lethal_icon_color = "green"
lethal_projectile = /obj/item/projectile/beam/mininglaser
lethal_shot_sound = 'sound/weapons/eluger.ogg'
icon_color = "red"
projectile = /obj/item/projectile/beam/weaklaser
shot_sound = 'sound/weapons/Laser.ogg'
/obj/machinery/porta_turret/proc/isLocked(mob/user)
if(ailock && issilicon(user))
to_chat(user, "<span class='notice'>There seems to be a firewall preventing you from accessing this device.</span>")
@@ -442,6 +472,8 @@
settings[++settings.len] = list("category" = "Check misc. Lifeforms", "setting" = "check_anomalies", "value" = check_anomalies)
settings[++settings.len] = list("category" = "Neutralize All Entities", "setting" = "check_all", "value" = check_all)
settings[++settings.len] = list("category" = "Neutralize Downed Entities", "setting" = "check_down", "value" = check_down)
settings[++settings.len] = list("category" = "Remain Deployed", "setting" = "stay_up", "value" = stay_up)
settings[++settings.len] = list("category" = "Fire At Movement", "setting" = "fire_at_movement", "value" = fire_at_movement)
data["settings"] = settings
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
@@ -495,6 +527,10 @@
check_all = value
else if(href_list["command"] == "check_down")
check_down = value
else if(href_list["command"] == "stay_up")
stay_up = value
else if(href_list["command"] == "fire_at_movement")
fire_at_movement = value
return 1
@@ -698,6 +734,10 @@
popDown()
return
if(stay_up)
timeout = 10
popUp()
var/list/targets = list() //list of primary targets
var/list/secondarytargets = list() //targets that are least important
@@ -720,7 +760,7 @@
if(!tryToShootAt(targets))
if(!tryToShootAt(secondarytargets)) // if no valid targets, go for secondary targets
timeout--
if(timeout <= 0)
if(timeout <= 0 && !stay_up)
spawn()
popDown() // no valid targets, close the cover
@@ -728,6 +768,14 @@
use_power(20000)
health = min(health+1, maxhealth) // 1HP for 20kJ
// We're expecting the first arg to be a target, for this we don't care about previous and next turfs.
/obj/machinery/porta_turret/proc/point_defense(var/atom/movable/Targ)
if((stat & (NOPOWER|BROKEN)) || !fire_at_movement) // Are we even able or supposed to fire at non-moving targets?
return
if((isliving(Targ) && assess_living(Targ)) || ((istype(Targ, /obj/item) || istype(Targ, /obj/effect/meteor)) && Targ.invisibility < INVISIBILITY_LEVEL_ONE && Targ in view(7,src))) // Is the target a living thing, if so, is it a valid target? Or if it's not living, is it in sight?
target(Targ) // Yes? Blast it.
/obj/machinery/porta_turret/proc/assess_and_assign(var/mob/living/L, var/list/targets, var/list/secondarytargets)
switch(assess_living(L))
if(TURRET_PRIORITY_TARGET)
@@ -754,10 +802,10 @@
if(L.stat == DEAD && !emagged) //if the perp is dead, no need to bother really
return TURRET_NOT_TARGET //move onto next potential victim!
if(get_dist(src, L) > 7) //if it's too far away, why bother?
if(get_dist(src, get_turf(L)) > 7) //if it's too far away, why bother?
return TURRET_NOT_TARGET
if(!(L in check_trajectory(L, src))) //check if we have true line of sight
if(!(L in check_trajectory(get_turf(L), src))) //check if we have true line of sight
return TURRET_NOT_TARGET
if(emagged) // If emagged not even the dead get a rest
@@ -864,8 +912,9 @@
last_target = target
spawn()
popUp() //pop the turret up if it's not already up.
set_dir(get_dir(src, target)) //even if you can't shoot, follow the target
playsound(src, 'sound/machines/turrets/turret_rotate.ogg', 100, 1) // Play rotating sound
if(dir != get_dir(src, target))
set_dir(get_dir(src, target)) //even if you can't shoot, follow the target
playsound(src, 'sound/machines/turrets/turret_rotate.ogg', 100, 1) // Play rotating sound
spawn()
shootAt(target)
return 1
@@ -929,6 +978,9 @@
var/check_weapons
var/check_anomalies
var/check_all
var/check_down
var/fire_at_movement
var/stay_up
var/ailock
/obj/machinery/porta_turret/proc/setState(var/datum/turret_checks/TC)
@@ -944,6 +996,9 @@
check_weapons = TC.check_weapons
check_anomalies = TC.check_anomalies
check_all = TC.check_all
check_down = TC.check_down
fire_at_movement = TC.fire_at_movement
stay_up = TC.stay_up
ailock = TC.ailock
power_change()

View File

@@ -25,6 +25,9 @@
var/check_anomalies = 1 //checks if it can shoot at unidentified lifeforms (ie xenos)
var/check_synth = 0 //if active, will shoot at anything not an AI or cyborg
var/check_all = 0 //If active, will shoot at anything.
var/check_down = 0 //If active, will shoot at prone individuals.
var/stay_up = 0 //If active, the turret will not pop-down unless it loses power or is disabled.
var/fire_at_movement = 0 //If active, the turret will prioritize objects or creatures that move in its range.
var/ailock = 0 //Silicons cannot use this
req_access = list(access_ai_upload)
@@ -134,6 +137,9 @@
settings[++settings.len] = list("category" = "Check Access Authorization", "setting" = "check_access", "value" = check_access)
settings[++settings.len] = list("category" = "Check misc. Lifeforms", "setting" = "check_anomalies", "value" = check_anomalies)
settings[++settings.len] = list("category" = "Neutralize All Entities", "setting" = "check_all", "value" = check_all)
settings[++settings.len] = list("category" = "Neutralize Downed Entities", "setting" = "check_down", "value" = check_down)
settings[++settings.len] = list("category" = "Remain Deployed", "setting" = "stay_up", "value" = stay_up)
settings[++settings.len] = list("category" = "Fire At Movement", "setting" = "fire_at_movement", "value" = fire_at_movement)
data["settings"] = settings
@@ -168,6 +174,12 @@
check_anomalies = value
else if(href_list["command"] == "check_all")
check_all = value
else if(href_list["command"] == "check_down")
check_down = value
else if(href_list["command"] == "stay_up")
stay_up = value
else if(href_list["command"] == "fire_at_movement")
fire_at_movement = value
updateTurrets()
return 1
@@ -183,6 +195,9 @@
TC.check_weapons = check_weapons
TC.check_anomalies = check_anomalies
TC.check_all = check_all
TC.check_down = check_down
TC.stay_up = stay_up
TC.fire_at_movement = fire_at_movement
TC.ailock = ailock
if(istype(control_area))

View File

@@ -57,6 +57,28 @@
item_state = "lrifle"
origin_tech = list(TECH_COMBAT = 4, TECH_MAGNET = 3)
/obj/item/weapon/gun/energy/mininglaser
name = "mining-laser rifle"
desc = "A Hephaestus Industries G22T rifle, now only produced for its impeccable ability to break stone with its pulsating blasts."
description_fluff = "The leading arms producer in the SCG, Hephaestus typically only uses its 'top level' branding for its military-grade equipment used by armed forces across human space."
icon = 'icons/obj/gun2.dmi'
icon_state = "mininglaser"
item_state = "laser"
wielded_item_state = "laser-wielded"
fire_delay = 8
slot_flags = SLOT_BELT|SLOT_BACK
w_class = ITEMSIZE_LARGE
force = 15
origin_tech = list(TECH_COMBAT = 3, TECH_MAGNET = 2)
matter = list(DEFAULT_WALL_MATERIAL = 2000)
projectile_type = /obj/item/projectile/beam/mininglaser
one_handed_penalty = 30
firemodes = list(
list(mode_name="mining", fire_delay=8, projectile_type=/obj/item/projectile/beam/mininglaser, charge_cost = 200),
list(mode_name="deter", fire_delay=5, projectile_type=/obj/item/projectile/beam/weaklaser, charge_cost = 80),
)
/obj/item/weapon/gun/energy/retro
name = "retro laser"
icon_state = "retro"

View File

@@ -17,6 +17,8 @@
hitsound = 'sound/weapons/sear.ogg'
hitsound_wall = 'sound/weapons/effects/searwall.ogg'
excavation_amount = 50
muzzle_type = /obj/effect/projectile/muzzle/laser
tracer_type = /obj/effect/projectile/tracer/laser
impact_type = /obj/effect/projectile/impact/laser
@@ -46,6 +48,18 @@
damage = 40
armor_penetration = 10
/obj/item/projectile/beam/mininglaser
name = "pulsating laser"
damage = 10
armor_penetration = 20
fire_sound = 'sound/weapons/eluger.ogg'
excavation_amount = 100
muzzle_type = /obj/effect/projectile/muzzle/emitter
tracer_type = /obj/effect/projectile/tracer/emitter
impact_type = /obj/effect/projectile/impact/emitter
/obj/item/projectile/beam/heavylaser
name = "heavy laser"
icon_state = "heavylaser"

View File

@@ -10,6 +10,7 @@
sharp = 1
hitsound_wall = "ricochet"
impact_effect_type = /obj/effect/temp_visual/impact_effect
excavation_amount = 20
var/mob_passthrough_check = 0
muzzle_type = /obj/effect/projectile/muzzle/bullet

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 121 KiB