diff --git a/code/game/machinery/anti_bluespace.dm b/code/game/machinery/anti_bluespace.dm index e10493348a1..94c50abe864 100644 --- a/code/game/machinery/anti_bluespace.dm +++ b/code/game/machinery/anti_bluespace.dm @@ -55,13 +55,6 @@ anchored = 0 update_icon() -/obj/machinery/anti_bluespace/attack_hand(mob/user as mob) - if(ishuman(user) && user.a_intent == I_HURT) - visible_message(span("warning","\The [user] hits \the [src]!")) - do_break() - else - . = ..() - /obj/machinery/anti_bluespace/attackby(obj/item/weapon/W as obj, mob/user as mob) if(user.a_intent == I_HURT) visible_message(span("warning","\The [user] hits \the [src] with \the [W]!")) @@ -75,6 +68,8 @@ /obj/machinery/anti_bluespace/bullet_act(var/obj/item/projectile/Proj) if(!(Proj.damage_type == BRUTE || Proj.damage_type == BURN)) return + if(!Proj.damage) + return do_break() diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm index b51f80d7f2e..8156e7c2f14 100644 --- a/code/game/machinery/portable_turret.dm +++ b/code/game/machinery/portable_turret.dm @@ -28,7 +28,7 @@ var/locked = 1 //if the turret's behaviour control access is locked var/controllock = 0 //if the turret responds to control panels - var/installation = /obj/item/weapon/gun/energy/gun //the type of weapon installed + var/obj/item/weapon/gun/energy/installation = /obj/item/weapon/gun/energy/gun //the type of weapon installed var/gun_charge = 0 //the charge of the gun inserted var/reqpower = 500 //holder for power needed var/lethal_icon = 0 //holder for the icon_state. 1 for lethal sprite, null for stun sprite. @@ -66,6 +66,25 @@ var/wrenching = 0 var/last_target //last target fired at, prevents turrets from erratically firing at all valid targets in range + var/list/targets = list() //list of primary targets + var/list/secondarytargets = list() //targets that are least important + var/resetting = FALSE + var/fast_processing = FALSE + +/obj/machinery/porta_turret/examine(mob/user) + ..() + var/msg = "" + if(!health) + msg += span("danger", "\The [src] is destroyed!") + else if(health / maxhealth < 0.35) + msg += span("danger", "\The [src] is critically damaged!") + else if(health / maxhealth < 0.6) + msg += span("warning", "\The [src] is badly damaged!") + else if(health / maxhealth < 1) + msg += span("notice", "\The [src] is slightly damaged!") + else + msg += span("good", "\The [src] is not damaged!") + to_chat(user, msg) /obj/machinery/porta_turret/crescent enabled = FALSE @@ -102,6 +121,14 @@ //Sets up a spark system spark_system = bind_spark(src, 5) + if(!istype(installation, /obj/item/weapon/gun/energy)) + installation = new installation(src) + if(installation) + if(installation.fire_delay_wielded > 0) + shot_delay = max(installation.fire_delay_wielded, 4) + else + shot_delay = max(installation.fire_delay, 4) + name = "[installation.name] [name]" var/area/control_area = get_area(src) if(istype(control_area)) @@ -115,6 +142,7 @@ if(SOME_TC.lethal != lethal && !egun) SOME_TC.enabled = 0 src.setState(SOME_TC) + START_PROCESSING(SSprocessing, src) /obj/machinery/porta_turret/crescent/Initialize() . = ..() @@ -129,6 +157,11 @@ aTurretID.turretModes() qdel(spark_system) spark_system = null + if(fast_processing) + STOP_PROCESSING(SSfast_process, src) + else + STOP_PROCESSING(SSprocessing, src) + . = ..() @@ -165,42 +198,43 @@ return 0 /obj/machinery/porta_turret/attack_ai(mob/user) - if(isLocked(user)) - return - ui_interact(user) /obj/machinery/porta_turret/attack_hand(mob/user) - if(isLocked(user)) - return - ui_interact(user) -/obj/machinery/porta_turret/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) - var/data[0] - data["access"] = !isLocked(user) - data["locked"] = locked - data["enabled"] = enabled - data["is_lethal"] = 1 - data["lethal"] = lethal - data["can_switch"] = egun +/obj/machinery/porta_turret/vueui_data_change(var/list/data, var/mob/user, var/datum/vueui/ui) + . = ..() + data = . || data + if(!data) + data = list() + VUEUI_SET_CHECK(data["locked"], locked, ., data) + VUEUI_SET_CHECK(data["enabled"], enabled, ., data) + VUEUI_SET_CHECK(data["is_lethal"], 1, ., data) + VUEUI_SET_CHECK(data["lethal"], lethal, ., data) + VUEUI_SET_CHECK(data["can_switch"], egun, ., data) - if(data["access"]) - var/settings[0] - settings[++settings.len] = list("category" = "Neutralize All Non-Synthetics", "setting" = "check_synth", "value" = check_synth) - settings[++settings.len] = list("category" = "Check Weapon Authorization", "setting" = "check_weapons", "value" = check_weapons) - settings[++settings.len] = list("category" = "Check Security Records", "setting" = "check_records", "value" = check_records) - settings[++settings.len] = list("category" = "Check Arrest Status", "setting" = "check_arrest", "value" = check_arrest) - 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) - data["settings"] = settings + var/usedSettings = list( + "check_synth" = "Neutralize All Non-Synthetics", + "check_weapons" = "Check Weapon Authorization", + "check_records" = "Check Security Records", + "check_arrest" ="Check Arrest Status", + "check_access" = "Check Access Authorization", + "check_anomalies" = "Check misc. Lifeforms" + ) + VUEUI_SET_IFNOTSET(data["settings"], list(), ., data) + for(var/v in usedSettings) + var/name = usedSettings[v] + VUEUI_SET_IFNOTSET(data["settings"][v], list(), ., data) + data["settings"][v]["category"] = name + VUEUI_SET_CHECK(data["settings"][v]["value"], vars[v], ., data) - ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open) + +/obj/machinery/porta_turret/ui_interact(mob/user) + var/datum/vueui/ui = SSvueui.get_open_ui(user, src) if (!ui) - ui = new(user, src, ui_key, "turret_control.tmpl", "Turret Controls", 500, 300) - ui.set_initial_data(data) - ui.open() - ui.set_auto_update(1) + ui = new(user, src, "turrets-control", 375, 725, "Turret Controls") + ui.open() /obj/machinery/porta_turret/proc/HasController() var/area/A = get_area(src) @@ -220,15 +254,21 @@ return ..() - /obj/machinery/porta_turret/Topic(href, href_list) - if(..()) - return 1 - - if(href_list["command"] && href_list["value"]) + if(href_list["command"] && !isnull(href_list["value"])) var/value = text2num(href_list["value"]) if(href_list["command"] == "enable") enabled = value + if (enabled) + START_PROCESSING(SSprocessing, src) + fast_processing = FALSE + else if(fast_processing) + STOP_PROCESSING(SSfast_process, src) + fast_processing = FALSE + popDown() + else + STOP_PROCESSING(SSprocessing, src) + popDown() else if(href_list["command"] == "lethal") lethal = value lethal_icon = value @@ -244,7 +284,7 @@ check_access = value else if(href_list["command"] == "check_anomalies") check_anomalies = value - + SSvueui.check_uis_for_change(src) return 1 /obj/machinery/porta_turret/power_change() @@ -268,9 +308,8 @@ if(prob(70) && !no_salvage) to_chat(user, "You remove the turret and salvage some components.") if(installation) - var/obj/item/weapon/gun/energy/Gun = new installation(loc) - Gun.power_supply.charge = gun_charge - Gun.update_icon() + installation.forceMove(loc) + installation = null if(prob(50)) new /obj/item/stack/material/steel(loc, rand(1,4)) if(prob(50)) @@ -322,7 +361,29 @@ updateUsrDialog() else to_chat(user, "Access denied.") - + + else if(I.iswelder()) + var/obj/item/weapon/weldingtool/WT = I + if (!WT.welding) + to_chat(user, "\The [WT] must be turned on!") + return + else if (health == maxhealth) + to_chat(user, "\The [src] is fully repaired.") + return + else if (WT.remove_fuel(3, user)) + to_chat(user, "Now welding \the [src].") + if(do_after(user, 5)) + if(QDELETED(src) || !WT.isOn()) + return + playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1) + health += maxhealth / 3 + health = min(maxhealth, health) + return + else + to_chat(user, "You fail to complete the welding.") + else + to_chat(user, "You need more welding fuel to complete this task.") + return 1 else //if the turret was attacked with the intention of harming it: user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) @@ -330,11 +391,11 @@ if(I.force * 0.5 > 1) //if the force of impact dealt at least 1 damage, the turret gets pissed off if(!attacked && !emagged) attacked = 1 - addtimer(CALLBACK(src, .proc/reset_attacked), 6 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE) + addtimer(CALLBACK(src, .proc/reset_attacked), 1 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE) ..() /obj/machinery/porta_turret/proc/reset_attacked() - attacked = 0 + attacked = FALSE /obj/machinery/porta_turret/emag_act(var/remaining_charges, var/mob/user) if(!emagged) @@ -345,6 +406,7 @@ emagged = 1 lethal_icon = 1 controllock = 1 + shot_delay = shot_delay / 2 enabled = 0 //turns off the turret temporarily sleep(60) //6 seconds for the traitor to gtfo of the area before the turret decides to ruin his shit enabled = 1 //turns it back on. The cover popUp() popDown() are automatically called in process(), no need to define it here @@ -414,9 +476,8 @@ spark_system.queue() //creates some sparks because they look cool update_icon() -/obj/machinery/porta_turret/machinery_process() +/obj/machinery/porta_turret/process() //the main machinery process - if(stat & (NOPOWER|BROKEN)) //if the turret has no power or is broken, make the turret pop down if it hasn't already popDown() @@ -427,8 +488,8 @@ popDown() return - var/list/targets = list() //list of primary targets - var/list/secondarytargets = list() //targets that are least important + targets = list() + secondarytargets = list() for(var/v in view(world.view, src)) if(isliving(v)) @@ -440,13 +501,30 @@ secondarytargets += M if(!tryToShootAt(targets)) - if(!tryToShootAt(secondarytargets)) // if no valid targets, go for secondary targets - popDown() // no valid targets, close the cover + if(!tryToShootAt(secondarytargets) && !resetting) // if no valid targets, go for secondary targets + resetting = TRUE + addtimer(CALLBACK(src, .proc/reset), 6 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE) // no valid targets, close the cover + + if(targets.len || secondarytargets.len) + if(!fast_processing) + STOP_PROCESSING(SSprocessing, src) + START_PROCESSING(SSfast_process, src) + fast_processing = TRUE + else + if(fast_processing) + STOP_PROCESSING(SSfast_process, src) + START_PROCESSING(SSprocessing, src) + fast_processing = FALSE if(auto_repair && (health < maxhealth)) use_power(20000) health = min(health+1, maxhealth) // 1HP for 20kJ +/obj/machinery/porta_turret/proc/reset() + if(!targets.len && !secondarytargets.len) + popDown() + resetting = FALSE + /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) @@ -587,15 +665,12 @@ return /obj/machinery/porta_turret/proc/reset_last_fired() - last_fired = 0 + last_fired = FALSE /obj/machinery/porta_turret/proc/shootAt(var/mob/living/target) //any emagged turrets will shoot extremely fast! This not only is deadly, but drains a lot power! - if(!(emagged || attacked)) //if it hasn't been emagged or attacked, it has to obey a cooldown rate - if(last_fired || !raised) //prevents rapid-fire shooting, unless it's been emagged - return - last_fired = 1 - addtimer(CALLBACK(src, .proc/reset_last_fired), shot_delay) + if(last_fired || !raised) //prevents rapid-fire shooting, unless it's been emagged + return var/turf/T = get_turf(src) var/turf/U = get_turf(target) @@ -623,6 +698,8 @@ var/def_zone = get_exposed_defense_zone(target) //Shooting Code: A.launch_projectile(target, def_zone) + last_fired = TRUE + addtimer(CALLBACK(src, .proc/reset_last_fired), shot_delay, TIMER_UNIQUE | TIMER_OVERRIDE) /datum/turret_checks var/enabled @@ -639,6 +716,14 @@ if(controllock) return src.enabled = TC.enabled + if (enabled) + START_PROCESSING(SSprocessing, src) + fast_processing = FALSE + else if(fast_processing) + STOP_PROCESSING(SSprocessing, src) + fast_processing = FALSE + else + STOP_PROCESSING(SSfast_process, src) if(egun) //If turret can switch modes. src.lethal = TC.lethal src.lethal_icon = TC.lethal @@ -667,7 +752,7 @@ var/target_type = /obj/machinery/porta_turret // The type we intend to build var/build_step = 0 //the current step in the building process var/finish_name = "turret" //the name applied to the product turret - var/installation = null //the gun type installed + var/obj/item/weapon/gun/energy/installation = null //the gun type installed var/case_sprite_set = 0 //sprite set the turret case will use var/obj/item/weapon/gun/energy/E = null @@ -752,7 +837,7 @@ to_chat(user, "You install [I] into the turret.") user.drop_from_inventory(E,src) target_type = /obj/machinery/porta_turret - installation = I.type //installation becomes I.type + installation = I //installation becomes I.type build_step = 4 icon_state = "turret_frame_4_[case_sprite_set]" add_overlay("turret_[E.turret_sprite_set]_off") @@ -849,13 +934,13 @@ Turret.lethal_icon = E.turret_is_lethal // Check if gun has wielded delay, turret will have same fire rate as the gun. if(E.fire_delay_wielded > 0) - Turret.shot_delay = E.fire_delay_wielded + Turret.shot_delay = max(E.fire_delay_wielded, 4) else - Turret.shot_delay = E.fire_delay + Turret.shot_delay = max(E.fire_delay, 4) Turret.cover_set = case_sprite_set Turret.icon_state = "cover_[case_sprite_set]" - + START_PROCESSING(SSprocessing, Turret) qdel(src) // qdel else if(I.iscrowbar()) @@ -1013,4 +1098,4 @@ #undef TURRET_PRIORITY_TARGET #undef TURRET_SECONDARY_TARGET -#undef TURRET_NOT_TARGET +#undef TURRET_NOT_TARGET \ No newline at end of file diff --git a/code/game/machinery/turret_control.dm b/code/game/machinery/turret_control.dm index acfa7565717..604e74a1952 100644 --- a/code/game/machinery/turret_control.dm +++ b/code/game/machinery/turret_control.dm @@ -1,7 +1,6 @@ //////////////////////// //Turret Control Panel// //////////////////////// - /area // Turrets use this list to see if individual power/lethal settings are allowed var/list/turret_controls = list() @@ -28,10 +27,8 @@ 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/ailock = 0 //Silicons cannot use this - req_access = list(access_ai_upload) - // list of turrets under control /obj/machinery/turretid/stun enabled = 1 @@ -127,58 +124,85 @@ ui_interact(user) -/obj/machinery/turretid/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) - var/data[0] - data["access"] = !isLocked(user) - data["locked"] = locked - data["enabled"] = enabled - data["is_lethal"] = 1 - data["lethal"] = lethal - data["can_switch"] = egun +/obj/machinery/turretid/vueui_data_change(var/list/data, var/mob/user, var/datum/vueui/ui) + . = ..() + data = . || data + if(!data) + data = list() + VUEUI_SET_IFNOTSET(data["turrets"], list(), ., data) + VUEUI_SET_CHECK(data["locked"], locked, ., data) + VUEUI_SET_CHECK(data["enabled"], enabled, ., data) + VUEUI_SET_CHECK(data["is_lethal"], 1, ., data) + VUEUI_SET_CHECK(data["lethal"], lethal, ., data) + VUEUI_SET_CHECK(data["can_switch"], egun, ., data) - if(data["access"]) - var/settings[0] - settings[++settings.len] = list("category" = "Neutralize All Non-Synthetics", "setting" = "check_synth", "value" = check_synth) - settings[++settings.len] = list("category" = "Check Weapon Authorization", "setting" = "check_weapons", "value" = check_weapons) - settings[++settings.len] = list("category" = "Check Security Records", "setting" = "check_records", "value" = check_records) - settings[++settings.len] = list("category" = "Check Arrest Status", "setting" = "check_arrest", "value" = check_arrest) - 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) - data["settings"] = settings + var/usedSettings = list( + "check_synth" = "Neutralize All Non-Synthetics", + "check_weapons" = "Check Weapon Authorization", + "check_records" = "Check Security Records", + "check_arrest" ="Check Arrest Status", + "check_access" = "Check Access Authorization", + "check_anomalies" = "Check misc. Lifeforms" + ) + VUEUI_SET_IFNOTSET(data["settings"], list(), ., data) + for(var/v in usedSettings) + var/name = usedSettings[v] + VUEUI_SET_IFNOTSET(data["settings"][v], list(), ., data) + data["settings"][v]["category"] = name + VUEUI_SET_CHECK(data["settings"][v]["value"], vars[v], ., data) - ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open) + if(istype(control_area)) + if(control_area.turrets.len != data["turrets"].len) + data["turrets"] = list() + for (var/obj/machinery/porta_turret/aTurret in control_area.turrets) + var/ref = "\ref[aTurret]" + VUEUI_SET_IFNOTSET(data["turrets"][ref], list("ref" = ref), ., data) + VUEUI_SET_IFNOTSET(data["turrets"][ref]["name"], sanitize(aTurret.name + " [data["turrets"].len]"), ., data) + var/rtn = aTurret.vueui_data_change(data["turrets"][ref]["settings"], user, ui) + if(rtn) + data["turrets"][ref]["settings"] = rtn + . = data + + +/obj/machinery/turretid/ui_interact(mob/user) + var/datum/vueui/ui = SSvueui.get_open_ui(user, src) if (!ui) - ui = new(user, src, ui_key, "turret_control.tmpl", "Turret Controls", 500, 300) - ui.set_initial_data(data) - ui.open() - ui.set_auto_update(1) + ui = new(user, src, "turrets-control", 375, 725, "Turret Controls") + ui.open() /obj/machinery/turretid/Topic(href, href_list) if(..()) return 1 - if(href_list["command"] && href_list["value"]) - var/value = text2num(href_list["value"]) - if(href_list["command"] == "enable") - enabled = value - else if(href_list["command"] == "lethal") - lethal = value - else if(href_list["command"] == "check_synth") - check_synth = value - else if(href_list["command"] == "check_weapons") - check_weapons = value - else if(href_list["command"] == "check_records") - check_records = value - else if(href_list["command"] == "check_arrest") - check_arrest = value - else if(href_list["command"] == "check_access") - check_access = value - else if(href_list["command"] == "check_anomalies") - check_anomalies = value - - updateTurrets() + if(href_list["turret_ref"] == "this") + if(href_list["command"] && !isnull(href_list["value"])) + var/value = text2num(href_list["value"]) + if(href_list["command"] == "enable") + enabled = value + else if(href_list["command"] == "lethal") + lethal = value + else if(href_list["command"] == "check_synth") + check_synth = value + else if(href_list["command"] == "check_weapons") + check_weapons = value + else if(href_list["command"] == "check_records") + check_records = value + else if(href_list["command"] == "check_arrest") + check_arrest = value + else if(href_list["command"] == "check_access") + check_access = value + else if(href_list["command"] == "check_anomalies") + check_anomalies = value + updateTurrets() + update_icon() + SSvueui.check_uis_for_change(src) + else if(href_list["turret_ref"]) + var/obj/machinery/porta_turret/aTurret = locate(href_list["turret_ref"]) in (control_area.turrets) + if(!aTurret) + return + . = aTurret.Topic(href, href_list) + SSvueui.check_uis_for_change(src) update_icon() - return 1 /obj/machinery/turretid/proc/updateTurrets() var/datum/turret_checks/TC = getState() diff --git a/code/modules/economy/quikpay.dm b/code/modules/economy/quikpay.dm index 9bd93ca0bb0..bfa42f9763d 100644 --- a/code/modules/economy/quikpay.dm +++ b/code/modules/economy/quikpay.dm @@ -130,7 +130,7 @@ ui = new(usr, src, "quikpay-main", 400, 400, "NT Quik-Pay") ui.open() -/obj/item/device/nanoquikpay/vueui_data_change(var/list/data, var/mob/user, var/datum/vueui/ui, var/list/newdata) +/obj/item/device/nanoquikpay/vueui_data_change(var/list/data, var/mob/user, var/datum/vueui/ui) if(!data) . = data = list() diff --git a/code/modules/mob/living/simple_animal/hostile/carp.dm b/code/modules/mob/living/simple_animal/hostile/carp.dm index f0eaa35b3ed..f3b7619e7b3 100644 --- a/code/modules/mob/living/simple_animal/hostile/carp.dm +++ b/code/modules/mob/living/simple_animal/hostile/carp.dm @@ -67,29 +67,15 @@ return ..() /mob/living/simple_animal/hostile/carp/AttackingTarget() - setClickCooldown(attack_delay) - if(!Adjacent(target_mob)) + . = ..() + if(.) return - if(isliving(target_mob)) - var/mob/living/L = target_mob - if(prob(15)) - L.Weaken(3) - L.visible_message("\the [src] knocks down \the [L]!") - L.attack_generic(src,rand(melee_damage_lower,melee_damage_upper),attacktext) - return L - if(istype(target_mob,/obj/mecha)) - var/obj/mecha/M = target_mob - M.attack_generic(src,rand(melee_damage_lower,melee_damage_upper),attacktext) - return M - if(istype(target_mob,/obj/machinery/bot)) - var/obj/machinery/bot/B = target_mob - B.attack_generic(src,rand(melee_damage_lower,melee_damage_upper),attacktext) - return B if(istype(target_mob, /obj/effect/energy_field)) var/obj/effect/energy_field/e = target_mob e.Stress(rand(1,2)) visible_message("\the [src] has attacked [e]!") src.do_attack_animation(e) + return e /mob/living/simple_animal/hostile/carp/DestroySurroundings(var/bypass_prob = FALSE) if(prob(break_stuff_probability) || bypass_prob) diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 41ba2c29005..ab7e68d8bd3 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -32,6 +32,7 @@ target_type_validator_map[/mob/living] = CALLBACK(src, .proc/validator_living) target_type_validator_map[/obj/mecha] = CALLBACK(src, .proc/validator_mecha) target_type_validator_map[/obj/machinery/bot] = CALLBACK(src, .proc/validator_bot) + target_type_validator_map[/obj/machinery/porta_turret] = CALLBACK(src, .proc/validator_turret) /mob/living/simple_animal/hostile/Destroy() friends = null @@ -166,16 +167,22 @@ mob/living/simple_animal/hostile/hitby(atom/movable/AM as mob|obj,var/speed = TH LoseTarget() if(isliving(target_mob)) var/mob/living/L = target_mob - L.attack_generic(src,rand(melee_damage_lower,melee_damage_upper),attacktext) + L.attack_generic(src, rand(melee_damage_lower, melee_damage_upper), attacktext) return L - if(istype(target_mob,/obj/mecha)) + if(istype(target_mob, /obj/mecha)) var/obj/mecha/M = target_mob - M.attack_generic(src,rand(melee_damage_lower,melee_damage_upper),attacktext) + M.attack_generic(src, rand(melee_damage_lower, melee_damage_upper), attacktext) return M - if(istype(target_mob,/obj/machinery/bot)) + if(istype(target_mob, /obj/machinery/bot)) var/obj/machinery/bot/B = target_mob - B.attack_generic(src,rand(melee_damage_lower,melee_damage_upper),attacktext) + B.attack_generic(src, rand(melee_damage_lower, melee_damage_upper), attacktext) return B + if(istype(target_mob, /obj/machinery/porta_turret)) + var/obj/machinery/porta_turret/T = target_mob + src.do_attack_animation(T) + T.take_damage(max(melee_damage_lower, melee_damage_upper) / 2) + visible_message("[src] [attacktext] \the [T]!") + return T /mob/living/simple_animal/hostile/proc/LoseTarget() stance = HOSTILE_STANCE_IDLE @@ -366,3 +373,8 @@ mob/living/simple_animal/hostile/hitby(atom/movable/AM as mob|obj,var/speed = TH return TRUE else return FALSE + +/mob/living/simple_animal/hostile/proc/validator_turret(var/obj/machinery/porta_turret/T, var/atom/current) + if(isliving(current)) // We prefer mobs over anything else + return FALSE + return !(T.health <= 0) diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 6513aa4cdbc..c45953ed120 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -509,14 +509,20 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj) var/mob/living/L = target_mob if(!L.stat) return (0) - if (istype(target_mob,/obj/mecha)) + if (istype(target_mob, /obj/mecha)) var/obj/mecha/M = target_mob if (M.occupant) return (0) - if (istype(target_mob,/obj/machinery/bot)) + if (istype(target_mob, /obj/machinery/bot)) var/obj/machinery/bot/B = target_mob if(B.health > 0) return (0) + if(istype(target_mob, /obj/machinery/porta_turret/)) + var/obj/machinery/porta_turret/T = target_mob + if(T.health > 0) + return (0) + if(istype(target_mob, /obj/effect/energy_field)) + return (0) return 1 /mob/living/simple_animal/say(var/message) diff --git a/code/modules/projectiles/guns/energy/laser.dm b/code/modules/projectiles/guns/energy/laser.dm index 710ef929503..9d830f1c06f 100644 --- a/code/modules/projectiles/guns/energy/laser.dm +++ b/code/modules/projectiles/guns/energy/laser.dm @@ -12,6 +12,7 @@ matter = list(DEFAULT_WALL_MATERIAL = 2000) projectile_type = /obj/item/projectile/beam/midlaser can_turret = 1 + turret_is_lethal = 1 turret_sprite_set = "laser" /obj/item/weapon/gun/energy/laser/mounted @@ -36,6 +37,7 @@ obj/item/weapon/gun/energy/retro projectile_type = /obj/item/projectile/beam fire_delay = 10 //old technology can_turret = 1 + turret_is_lethal = 1 turret_sprite_set = "retro" /obj/item/weapon/gun/energy/captain @@ -52,6 +54,7 @@ obj/item/weapon/gun/energy/retro max_shots = 5 //to compensate a bit for self-recharging self_recharge = 1 can_turret = 1 + turret_is_lethal = 1 turret_sprite_set = "captain" /obj/item/weapon/gun/energy/lasercannon @@ -67,6 +70,7 @@ obj/item/weapon/gun/energy/retro max_shots = 5 fire_delay = 20 can_turret = 1 + turret_is_lethal = 1 turret_sprite_set = "cannon" /obj/item/weapon/gun/energy/lasercannon/mounted @@ -88,6 +92,7 @@ obj/item/weapon/gun/energy/retro max_shots = 20 fire_delay = 1 can_turret = 1 + turret_is_lethal = 1 turret_sprite_set = "xray" /obj/item/weapon/gun/energy/xray/mounted @@ -116,6 +121,7 @@ obj/item/weapon/gun/energy/retro scoped_accuracy = 4 can_turret = 1 turret_sprite_set = "sniper" + turret_is_lethal = 1 fire_delay_wielded = 35 accuracy_wielded = 0 @@ -161,6 +167,7 @@ obj/item/weapon/gun/energy/retro fire_delay = 2 dispersion = list(10) can_turret = 1 + turret_is_lethal = 1 turret_sprite_set = "laser" ////////Laser Tag//////////////////// diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index fb193dd7214..42c716ee15e 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -284,6 +284,8 @@ setAngle(angle) // trajectory dispersion var/turf/starting = get_turf(src) + if(!starting) + return if(isnull(Angle)) //Try to resolve through offsets if there's no angle set. if(isnull(xo) || isnull(yo)) crash_with("WARNING: Projectile [type] deleted due to being unable to resolve a target after angle was null!") diff --git a/html/changelogs/Sindorman-turrets.yml b/html/changelogs/Sindorman-turrets.yml new file mode 100644 index 00000000000..f82a328f96e --- /dev/null +++ b/html/changelogs/Sindorman-turrets.yml @@ -0,0 +1,48 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: PoZe + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - tweak: "Emagging turrets now decreases their shot delay by half, instead of allowing them to bypass cooldown." + - tweak: "Hostile mobs now target turrets and attack the." + - tweak: "Turrets can now be repaired with welding tool if they are not completely destroyed." + - tweak: "Bluespace inhibitors no longer break when touched/hit with hands." + - tweak: "Bluespace inhibitors no longer break from projectiles that deal no damage(Like test projectile or stun)." + - tweak: "Turrets now now use faster processing(delay decreased from 2 second to 0.5 seconds process) if they have targets to shoot. Which makes them track and shoot faster than usual, allowing to unleash full potential of emagged and fast shooting guns." + - backend: "Disabling(turning it off) turret stops their processing, while enabling enables it. Cause no need to process turned off turret, lets save CPU." + - backend: "Turrets Control panel now uses VueUi instead of NanoUi." diff --git a/nano/templates/turret_control.tmpl b/nano/templates/turret_control.tmpl deleted file mode 100644 index 79f0d287281..00000000000 --- a/nano/templates/turret_control.tmpl +++ /dev/null @@ -1,48 +0,0 @@ -
-
- Behaviour controls are {{:data.locked ? "locked" : "unlocked"}}. -
-
-
-{{if data.access}} -
-
- Turret Status: -
-
- {{:helper.link('Enabled', null, {'command' : 'enable', 'value' : 1}, data.enabled ?'redButton' : null)}} - {{:helper.link('Disabled',null, {'command' : 'enable', 'value' : 0}, !data.enabled ? 'selected' : null)}} -
-
- - {{if data.is_lethal}} -
-
- Lethal Mode: -
- {{if data.can_switch}} -
- {{:helper.link('On', null, {'command' : 'lethal', 'value' : 1}, data.lethal ?'redButton' : null)}} - {{:helper.link('Off',null, {'command' : 'lethal', 'value' : 0}, !data.lethal ? 'selected' : null)}} -
- {{else}} -
- {{:helper.link('On', null, null, 'disabled')}} - {{:helper.link('Off',null, null, 'disabled')}} -
- {{/if}} -
- {{/if}} - - {{for data.settings}} -
-
- {{:value.category}} -
-
- {{:helper.link('On', null, {'command' : value.setting, 'value' : 1}, value.value ? 'selected' : null)}} - {{:helper.link('Off',null, {'command' : value.setting, 'value' : 0}, !value.value ? 'selected' : null)}} -
-
- {{/for}} -{{/if}} diff --git a/vueui/src/components/view/turrets/control-part.vue b/vueui/src/components/view/turrets/control-part.vue new file mode 100644 index 00000000000..97abc78f6de --- /dev/null +++ b/vueui/src/components/view/turrets/control-part.vue @@ -0,0 +1,31 @@ + + + \ No newline at end of file diff --git a/vueui/src/components/view/turrets/control.vue b/vueui/src/components/view/turrets/control.vue new file mode 100644 index 00000000000..c0a9404759b --- /dev/null +++ b/vueui/src/components/view/turrets/control.vue @@ -0,0 +1,24 @@ + + + \ No newline at end of file