Skip to content

Commit

Permalink
Smartgun IFF back (which I apparently turned off and forgot?)
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Oct 13, 2023
1 parent 6aee24a commit 1311919
Showing 1 changed file with 68 additions and 68 deletions.
136 changes: 68 additions & 68 deletions code/modules/projectiles/guns/smartgun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@
recoil = RECOIL_AMOUNT_TIER_3
damage_mult = BASE_BULLET_DAMAGE_MULT

///obj/item/weapon/gun/smartgun/set_bullet_traits()
//LAZYADD(traits_to_give, list(
// BULLET_TRAIT_ENTRY_ID("iff", /datum/element/bullet_trait_iff)
//))
/obj/item/weapon/gun/smartgun/set_bullet_traits()
LAZYADD(traits_to_give, list(
BULLET_TRAIT_ENTRY_ID("iff", /datum/element/bullet_trait_iff)
))

/obj/item/weapon/gun/smartgun/get_examine_text(mob/user)
. = ..()
Expand Down Expand Up @@ -265,46 +265,46 @@
else
button.icon_state = "template"

///datum/action/item_action/smartgun/toggle_lethal_mode/New(Target, obj/item/holder)
// . = ..()
// name = "Toggle IFF"
// action_icon_state = "iff_toggle_on"
// button.name = name
// button.overlays.Cut()
// button.overlays += image('icons/mob/hud/actions.dmi', button, action_icon_state)
/datum/action/item_action/smartgun/toggle_lethal_mode/New(Target, obj/item/holder)
. = ..()
name = "Toggle IFF"
action_icon_state = "iff_toggle_on"
button.name = name
button.overlays.Cut()
button.overlays += image('icons/mob/hud/actions.dmi', button, action_icon_state)

///datum/action/item_action/smartgun/toggle_lethal_mode/action_activate()
// . = ..()
// var/obj/item/weapon/gun/smartgun/G = holder_item
// G.toggle_lethal_mode(usr)
// if(G.iff_enabled)
// action_icon_state = "iff_toggle_on"
// else
// action_icon_state = "iff_toggle_off"
// button.overlays.Cut()
// button.overlays += image('icons/mob/hud/actions.dmi', button, action_icon_state)
/datum/action/item_action/smartgun/toggle_lethal_mode/action_activate()
. = ..()
var/obj/item/weapon/gun/smartgun/G = holder_item
G.toggle_lethal_mode(usr)
if(G.iff_enabled)
action_icon_state = "iff_toggle_on"
else
action_icon_state = "iff_toggle_off"
button.overlays.Cut()
button.overlays += image('icons/mob/hud/actions.dmi', button, action_icon_state)

///datum/action/item_action/smartgun/toggle_ammo_type/New(Target, obj/item/holder)
// . = ..()
// name = "Toggle Ammo Type"
// action_icon_state = "ammo_swap_normal"
// button.name = name
// button.overlays.Cut()
// button.overlays += image('icons/mob/hud/actions.dmi', button, action_icon_state)
/datum/action/item_action/smartgun/toggle_ammo_type/New(Target, obj/item/holder)
. = ..()
name = "Toggle Ammo Type"
action_icon_state = "ammo_swap_normal"
button.name = name
button.overlays.Cut()
button.overlays += image('icons/mob/hud/actions.dmi', button, action_icon_state)

///datum/action/item_action/smartgun/toggle_ammo_type/action_activate()
// . = ..()
// var/obj/item/weapon/gun/smartgun/G = holder_item
// G.toggle_ammo_type(usr)
/datum/action/item_action/smartgun/toggle_ammo_type/action_activate()
. = ..()
var/obj/item/weapon/gun/smartgun/G = holder_item
G.toggle_ammo_type(usr)

///datum/action/item_action/smartgun/toggle_ammo_type/proc/update_icon()
// var/obj/item/weapon/gun/smartgun/G = holder_item
// if(G.secondary_toggled)
// action_icon_state = "ammo_swap_ap"
// else
// action_icon_state = "ammo_swap_normal"
// button.overlays.Cut()
// button.overlays += image('icons/mob/hud/actions.dmi', button, action_icon_state)
/datum/action/item_action/smartgun/toggle_ammo_type/proc/update_icon()
var/obj/item/weapon/gun/smartgun/G = holder_item
if(G.secondary_toggled)
action_icon_state = "ammo_swap_ap"
else
action_icon_state = "ammo_swap_normal"
button.overlays.Cut()
button.overlays += image('icons/mob/hud/actions.dmi', button, action_icon_state)

//more general procs

Expand All @@ -325,40 +325,40 @@
to_chat(H, SPAN_WARNING("You can't fire \the [src] with the feed cover open! (alt-click to close)"))
return FALSE

///obj/item/weapon/gun/smartgun/unique_action(mob/user)
// if(isobserver(usr) || isxeno(usr))
// return
// toggle_ammo_type(usr)
/obj/item/weapon/gun/smartgun/unique_action(mob/user)
if(isobserver(usr) || isxeno(usr))
return
toggle_ammo_type(usr)

///obj/item/weapon/gun/smartgun/proc/toggle_ammo_type(mob/user)
// if(!iff_enabled)
// to_chat(user, "[icon2html(src, usr)] Can't switch ammunition type when \the [src]'s fire restriction is disabled.")
// return
// secondary_toggled = !secondary_toggled
// 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"].")
// 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/proc/toggle_ammo_type(mob/user)
if(!iff_enabled)
to_chat(user, "[icon2html(src, usr)] Can't switch ammunition type when \the [src]'s fire restriction is disabled.")
return
secondary_toggled = !secondary_toggled
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"].")
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? "<B>disable</b>" : "<B>enable</b>"] \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
// MD.iff_signal = initial(MD.iff_signal)
// if(!iff_enabled)
// remove_bullet_trait("iff")
// drain -= 10
// MD.iff_signal = null
/obj/item/weapon/gun/smartgun/proc/toggle_lethal_mode(mob/user)
to_chat(user, "[icon2html(src, usr)] You [iff_enabled? "<B>disable</b>" : "<B>enable</b>"] \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
MD.iff_signal = initial(MD.iff_signal)
if(!iff_enabled)
remove_bullet_trait("iff")
drain -= 10
MD.iff_signal = null

/obj/item/weapon/gun/smartgun/Fire(atom/target, mob/living/user, params, reflex = 0, dual_wield)
if(!requires_battery)
Expand Down

0 comments on commit 1311919

Please sign in to comment.