From 837e3f77b2decc5cd0b87f5922b4e16fb6a3e01b Mon Sep 17 00:00:00 2001 From: Kirshbia Date: Sun, 31 Mar 2024 21:51:55 -0400 Subject: [PATCH] SMARTGUN changes --- code/datums/ammo/bullet/special_ammo.dm | 9 ++++---- code/modules/projectiles/guns/smartgun.dm | 28 +++++++++++++++-------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/code/datums/ammo/bullet/special_ammo.dm b/code/datums/ammo/bullet/special_ammo.dm index e0ba0084bb..dbccd2af11 100644 --- a/code/datums/ammo/bullet/special_ammo.dm +++ b/code/datums/ammo/bullet/special_ammo.dm @@ -11,8 +11,9 @@ max_range = 12 accuracy = HIT_ACCURACY_TIER_4 - damage = 36 + damage = 35 penetration = 0 + /datum/ammo/bullet/smartgun/armor_piercing name = "armor-piercing smartgun bullet" @@ -20,7 +21,7 @@ accurate_range = 12 accuracy = HIT_ACCURACY_TIER_2 - damage = 24 + damage = 30 penetration = ARMOR_PENETRATION_TIER_8 damage_armor_punch = 1 @@ -39,13 +40,13 @@ accurate_range = 22 accuracy = HIT_ACCURACY_TIER_3 - damage = 30 + damage = 35 penetration = ARMOR_PENETRATION_TIER_7 damage_armor_punch = 3 /datum/ammo/bullet/smartgun/holo_target //Royal marines smartgun bullet has only diff between regular ammo is this one does holostacks name = "holo-targeting smartgun bullet" - damage = 30 + damage = 32 ///Stuff for the HRP holotargetting stacks var/holo_stacks = 15 diff --git a/code/modules/projectiles/guns/smartgun.dm b/code/modules/projectiles/guns/smartgun.dm index 2484e29c12..e29d9dbbd7 100644 --- a/code/modules/projectiles/guns/smartgun.dm +++ b/code/modules/projectiles/guns/smartgun.dm @@ -13,12 +13,6 @@ reload_sound = 'sound/weapons/handling/gun_sg_reload.ogg' unload_sound = 'sound/weapons/handling/gun_sg_unload.ogg' current_mag = /obj/item/ammo_magazine/smartgun - - accepted_ammo = list( - /obj/item/ammo_magazine/smartgun, - /obj/item/ammo_magazine/smartgun/holo_targetting, - /obj/item/ammo_magazine/smartgun/dirty, - ) flags_equip_slot = NO_FLAGS w_class = SIZE_HUGE force = 20 @@ -34,11 +28,14 @@ ammo = /datum/ammo/bullet/smartgun actions_types = list( /datum/action/item_action/smartgun/toggle_accuracy_improvement, - ///datum/action/item_action/smartgun/toggle_auto_fire, + /datum/action/item_action/smartgun/toggle_ammo_type, + ///datum/action/item_action/smartgun/toggle_auto_fire, /datum/action/item_action/smartgun/toggle_lethal_mode, ///datum/action/item_action/smartgun/toggle_motion_detector, - ///datum/action/item_action/smartgun/toggle_recoil_compensation, + /datum/action/item_action/smartgun/toggle_recoil_compensation, ) + var/datum/ammo/ammo_primary = /datum/ammo/bullet/smartgun/holo_target //Toggled ammo type + var/datum/ammo/ammo_secondary = /datum/ammo/bullet/smartgun/armor_piercing //Toggled ammo type var/iff_enabled = TRUE //Begin with the safety on. var/secondary_toggled = 0 //which ammo we use var/recoil_compensation = 0 @@ -71,12 +68,16 @@ /obj/item/weapon/gun/smartgun/Initialize(mapload, ...) + ammo_primary = GLOB.ammo_list[ammo_primary] //Gun initialize calls replace_ammo() so we need to set these first. + ammo_secondary = GLOB.ammo_list[ammo_secondary] MD = new(src) battery = new /obj/item/smartgun_battery(src) . = ..() update_icon() /obj/item/weapon/gun/smartgun/Destroy() + ammo_primary = null + ammo_secondary = null QDEL_NULL(MD) QDEL_NULL(battery) . = ..() @@ -339,15 +340,20 @@ to_chat(user, "[icon2html(src, usr)] You changed \the [src]'s ammo preparation procedures. You now fire [secondary_toggled ? "armor shredding rounds" : "highly precise rounds"].") balloon_alert(user, "firing [secondary_toggled ? "armor shredding" : "highly precise"]") playsound(loc,'sound/machines/click.ogg', 25, 1) - + ammo = secondary_toggled ? ammo_secondary : ammo_primary + var/datum/action/item_action/smartgun/toggle_ammo_type/TAT = locate(/datum/action/item_action/smartgun/toggle_ammo_type) in actions + TAT.update_icon() /obj/item/weapon/gun/smartgun/replace_ammo() ..() + ammo = secondary_toggled ? ammo_secondary : ammo_primary /obj/item/weapon/gun/smartgun/proc/toggle_lethal_mode(mob/user) to_chat(user, "[icon2html(src, usr)] You [iff_enabled? "disable" : "enable"] \the [src]'s fire restriction. You will [iff_enabled ? "harm anyone in your way" : "target through IFF"].") playsound(loc,'sound/machines/click.ogg', 25, 1) iff_enabled = !iff_enabled + ammo = ammo_primary + secondary_toggled = FALSE if(iff_enabled) add_bullet_trait(BULLET_TRAIT_ENTRY_ID("iff", /datum/element/bullet_trait_iff)) drain += 10 @@ -664,6 +670,8 @@ desc = "The actual firearm in the 4-piece M56D Smartgun System. If you have this, you're about to bring some serious pain to anyone in your way.\nYou may toggle firing restrictions by using a special action.\nAlt-click it to open the feed cover and allow for reloading." current_mag = /obj/item/ammo_magazine/smartgun/dirty ammo = /obj/item/ammo_magazine/smartgun/dirty + ammo_primary = /datum/ammo/bullet/smartgun/dirty//Toggled ammo type + ammo_secondary = /datum/ammo/bullet/smartgun/dirty/armor_piercing///Toggled ammo type flags_gun_features = GUN_WY_RESTRICTED|GUN_SPECIALIST|GUN_WIELDED_FIRING_ONLY /obj/item/weapon/gun/smartgun/dirty/Initialize(mapload, ...) @@ -737,6 +745,8 @@ desc = "The actual firearm in the 2-piece L56A2 Smartgun System. This Variant is used by the Three World Empires Royal Marines Commando units.\nYou may toggle firing restrictions by using a special action.\nAlt-click it to open the feed cover and allow for reloading." current_mag = /obj/item/ammo_magazine/smartgun/holo_targetting ammo = /obj/item/ammo_magazine/smartgun/holo_targetting + ammo_primary = /datum/ammo/bullet/smartgun/holo_target //Toggled ammo type + ammo_secondary = /datum/ammo/bullet/smartgun/holo_target/ap ///Toggled ammo type flags_gun_features = GUN_SPECIALIST|GUN_WIELDED_FIRING_ONLY icon = 'icons/obj/items/weapons/guns/guns_by_faction/twe_guns.dmi' icon_state = "magsg"