Skip to content

Commit

Permalink
refactor: Dominator Icon Updates Rework (#5075)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gottfrei authored Jul 9, 2024
1 parent 5320c63 commit 47f8a18
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 58 deletions.
27 changes: 15 additions & 12 deletions code/modules/projectiles/ammunition/energy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
desc = "The part of the gun that makes the laser go pew"
caliber = "energy"
projectile_type = /obj/item/projectile/energy
var/e_cost = 100 //The amount of energy a cell needs to expend to create this shot.
var/select_name = "energy"
var/alt_select_name = null
fire_sound = 'sound/weapons/gunshots/1laser10.ogg'
muzzle_flash_effect = /obj/effect/temp_visual/target_angled/muzzle_flash/energy
leaves_residue = 0
leaves_residue = FALSE
/// The amount of energy a cell needs to expend to create this shot.
var/e_cost = 100
/// Identifier for the firemode, mostly used in icon updates.
var/select_name = "energy"
/// Fluff fire mode name showed to the user.
var/fluff_select_name

/obj/item/ammo_casing/energy/laser
projectile_type = /obj/item/projectile/beam/laser
Expand Down Expand Up @@ -390,8 +393,8 @@
/obj/item/ammo_casing/energy/dominator/stun
projectile_type = /obj/item/projectile/energy/electrode/dominator
muzzle_flash_color = LIGHT_COLOR_LIGHTBLUE
select_name = "stun"
alt_select_name = "taser"
select_name = "taser"
fluff_select_name = "stun"
fire_sound = 'sound/weapons/gunshots/1taser.ogg'
e_cost = 250
delay = 15
Expand All @@ -400,25 +403,25 @@
/obj/item/ammo_casing/energy/dominator/paralyzer
projectile_type = /obj/item/projectile/beam/dominator/paralyzer
muzzle_flash_color = LIGHT_COLOR_LIGHTBLUE
select_name = "non-lethal paralyzer"
alt_select_name = "disable"
select_name = "disable"
fluff_select_name = "non-lethal paralyzer"
fire_sound = 'sound/weapons/plasma_cutter.ogg'
e_cost = 100
harmful = FALSE

/obj/item/ammo_casing/energy/dominator/eliminator
projectile_type = /obj/item/projectile/beam/dominator/eliminator
muzzle_flash_color = LIGHT_COLOR_DARKBLUE
select_name = "lethal-eliminator"
alt_select_name = "lethal"
select_name = "lethal"
fluff_select_name = "lethal-eliminator"
fire_sound = 'sound/weapons/gunshots/1laser10.ogg'
e_cost = 200

/obj/item/ammo_casing/energy/dominator/slaughter
projectile_type = /obj/item/projectile/beam/dominator/slaughter
muzzle_flash_color = LIGHT_COLOR_DARKBLUE
select_name = "execution-slaughter"
alt_select_name = "destroy"
select_name = "destroy"
fluff_select_name = "execution-slaughter"
fire_sound = 'sound/weapons/marauder.ogg'
e_cost = 250
delay = 30
Expand Down
4 changes: 2 additions & 2 deletions code/modules/projectiles/guns/energy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
var/obj/item/ammo_casing/energy/shot = ammo_type[select]
fire_sound = shot.fire_sound
fire_delay = shot.delay
if(!isnull(user) && shot.select_name)
if(!isnull(user) && (shot.select_name || shot.fluff_select_name))
var/static/gun_modes_ru = list( //about 2/3 of them will never be shown in game, but better save, than sorry
"practice" = "режим практики",
"kill" = "летальный режим",
Expand Down Expand Up @@ -277,7 +277,7 @@
"accelerator" = "ускоренный выстрел",
)

balloon_alert(user, "[gun_modes_ru[shot.select_name]]")
balloon_alert(user, "[gun_modes_ru[shot.fluff_select_name ? shot.fluff_select_name : shot.select_name]]")
if(chambered)//phil235
if(chambered.BB)
qdel(chambered.BB)
Expand Down
80 changes: 36 additions & 44 deletions code/modules/projectiles/guns/energy/special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -660,87 +660,79 @@
/obj/item/gun/energy/dominator
name = "Доминатор"
desc = "Проприетарное высокотехнологичное оружие правоохранительной организации Sibyl System, произведённое специально для борьбы с преступностью."
icon = 'icons/obj/weapons/sibyl.dmi'
icon = 'icons/obj/weapons/dominator.dmi'
icon_state = "dominator"
base_icon_state = "dominator"
item_state = null

w_class = WEIGHT_CLASS_NORMAL
slot_flags = ITEM_SLOT_BELT
force = 10
flags = CONDUCT
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF
resistance_flags = INDESTRUCTIBLE|LAVA_PROOF|FIRE_PROOF|ACID_PROOF
origin_tech = "combat=4;magnets=4"

ammo_type = list(/obj/item/ammo_casing/energy/dominator/stun, /obj/item/ammo_casing/energy/dominator/paralyzer, /obj/item/ammo_casing/energy/dominator/eliminator)
var/sound_voice = list(null, 'sound/voice/dominator/nonlethal-paralyzer.ogg','sound/voice/dominator/lethal-eliminator.ogg','sound/voice/dominator/execution-slaughter.ogg')
var/sound_cd = null
cell_type = /obj/item/stock_parts/cell/dominator
can_charge = TRUE
modifystate = TRUE
shaded_charge = TRUE
charge_sections = 3

can_flashlight = TRUE
gun_light_overlay = "flight"
flight_x_offset = 27
flight_y_offset = 12

ammo_type = list(
/obj/item/ammo_casing/energy/dominator/stun,
/obj/item/ammo_casing/energy/dominator/paralyzer,
/obj/item/ammo_casing/energy/dominator/eliminator,
)
/// Sounds played after selecting the firemode, must be in the same order as ammo_type
var/sound_voice = list(
null,
'sound/voice/dominator/nonlethal-paralyzer.ogg',
'sound/voice/dominator/lethal-eliminator.ogg',
'sound/voice/dominator/execution-slaughter.ogg',
)
/// Whether we are currently equipped or not.
/// Its rather this variable or delayed icon update on dropped.
var/is_equipped = FALSE

/obj/item/gun/energy/dominator/select_fire(mob/living/user)
..()
if(sibyl_mod && sibyl_mod.voice_is_enabled && !sound_cd)
var/temp_select = select
if(sound_voice[select] && select == temp_select)
sound_cd = addtimer(CALLBACK(src, PROC_REF(select_playvoice), user, temp_select), 2 SECONDS)


/obj/item/gun/energy/dominator/proc/select_playvoice(mob/living/user, temp_select)
user.playsound_local(get_turf(src), sound_voice[select], 50, FALSE)
sound_cd = null
/// Timestamp used for sound effects
COOLDOWN_DECLARE(last_sound_effect)


/obj/item/gun/energy/dominator/update_icon(updates = ALL)
is_equipped = ismob(loc)
/obj/item/gun/energy/dominator/select_fire(mob/living/user)
. = ..()
if(sibyl_mod?.voice_is_enabled && sound_voice[select] && COOLDOWN_FINISHED(src, last_sound_effect))
user.playsound_local(user, sound_voice[select], 50, FALSE)
COOLDOWN_START(src, last_sound_effect, 2 SECONDS)


/obj/item/gun/energy/dominator/update_icon_state()
icon_state = base_icon_state

if(!is_equipped)
if(!sibyl_mod)
return
icon_state = "[base_icon_state][sibyl_mod.auth_id ? "_unlock" : "_lock" ]"
return

ratio = CEILING((cell.charge / cell.maxcharge) * charge_sections, 1)
. = ..()
var/obj/item/ammo_casing/energy/shot = ammo_type[select]
var/shot_name = shot.alt_select_name
var/new_item_state = base_icon_state

if(cell.charge < shot.e_cost)
icon_state = "empty"
item_state = "[new_item_state]_empty"
item_state = "[base_icon_state]_empty"
else
icon_state = "[shot_name][ratio]"
item_state = "[new_item_state][shot_name]"
item_state = "[base_icon_state]_[shot.select_name]"


/obj/item/gun/energy/dominator/update_overlays()
if(is_equipped)
return ..()
. = list()
if(gun_light && can_flashlight)
if(sibyl_mod)
. += "[base_icon_state]_[sibyl_mod.auth_id ? "unlocked" : "locked"]"
if(gun_light && gun_light_overlay)
var/iconF = gun_light_overlay
if(gun_light.on)
iconF = "[gun_light_overlay]_on"
. += image(icon = icon, icon_state = iconF, pixel_x = flight_x_offset, pixel_y = flight_y_offset)


/obj/item/gun/energy/dominator/equipped(mob/user, slot, initial)
/obj/item/gun/energy/dominator/equipped(mob/user, slot, initial = FALSE)
. = ..()
is_equipped = TRUE
update_icon()


/obj/item/gun/energy/dominator/dropped(mob/user, slot, silent = FALSE)
. = ..()
is_equipped = FALSE
update_icon()


Expand Down
Binary file modified icons/mob/inhands/guns_lefthand.dmi
Binary file not shown.
Binary file modified icons/mob/inhands/guns_righthand.dmi
Binary file not shown.
Binary file added icons/obj/weapons/dominator.dmi
Binary file not shown.
Binary file modified icons/obj/weapons/sibyl.dmi
Binary file not shown.

0 comments on commit 47f8a18

Please sign in to comment.