Removing priority overlays, update_icon() splitup for guns.

This commit is contained in:
Ghommie
2020-08-20 18:33:23 +02:00
parent 20648fc1bb
commit fde859bca0
36 changed files with 295 additions and 303 deletions

View File

@@ -150,7 +150,6 @@
if (TRUE) {\ if (TRUE) {\
var/list/ad = A.add_overlays;\ var/list/ad = A.add_overlays;\
var/list/rm = A.remove_overlays;\ var/list/rm = A.remove_overlays;\
var/list/po = A.priority_overlays;\
if(LAZYLEN(rm)){\ if(LAZYLEN(rm)){\
A.overlays -= rm;\ A.overlays -= rm;\
A.remove_overlays = null;\ A.remove_overlays = null;\
@@ -159,11 +158,5 @@
A.overlays |= ad;\ A.overlays |= ad;\
A.add_overlays = null;\ A.add_overlays = null;\
}\ }\
if(LAZYLEN(po)){\
A.overlays |= po;\
}\
else{\
A.priority_overlays = null;\
}\
A.flags_1 &= ~OVERLAY_QUEUED_1;\ A.flags_1 &= ~OVERLAY_QUEUED_1;\
} }

View File

@@ -122,13 +122,13 @@
if(pixel_size == pixels) if(pixel_size == pixels)
return return
pixel_size = pixels pixel_size = pixels
cut_overlays(TRUE) cut_overlays()
//our icon size is 32 pixels. //our icon size is 32 pixels.
transform = matrix((pixels - (VOLUMETRIC_STORAGE_BOX_BORDER_SIZE * 2)) / VOLUMETRIC_STORAGE_BOX_ICON_SIZE, 0, 0, 0, 1, 0) transform = matrix((pixels - (VOLUMETRIC_STORAGE_BOX_BORDER_SIZE * 2)) / VOLUMETRIC_STORAGE_BOX_ICON_SIZE, 0, 0, 0, 1, 0)
left.pixel_x = -((pixels - VOLUMETRIC_STORAGE_BOX_ICON_SIZE) * 0.5) - VOLUMETRIC_STORAGE_BOX_BORDER_SIZE left.pixel_x = -((pixels - VOLUMETRIC_STORAGE_BOX_ICON_SIZE) * 0.5) - VOLUMETRIC_STORAGE_BOX_BORDER_SIZE
right.pixel_x = ((pixels - VOLUMETRIC_STORAGE_BOX_ICON_SIZE) * 0.5) + VOLUMETRIC_STORAGE_BOX_BORDER_SIZE right.pixel_x = ((pixels - VOLUMETRIC_STORAGE_BOX_ICON_SIZE) * 0.5) + VOLUMETRIC_STORAGE_BOX_BORDER_SIZE
add_overlay(left, TRUE) add_overlay(left)
add_overlay(right, TRUE) add_overlay(right)
/obj/screen/storage/volumetric_edge /obj/screen/storage/volumetric_edge
layer = VOLUMETRIC_STORAGE_BOX_LAYER layer = VOLUMETRIC_STORAGE_BOX_LAYER

View File

@@ -29,7 +29,7 @@ SUBSYSTEM_DEF(acid)
if(O.acid_level && O.acid_processing()) if(O.acid_level && O.acid_processing())
else else
O.cut_overlay(GLOB.acid_overlay, TRUE) O.update_icon()
processing -= O processing -= O
if (MC_TICK_CHECK) if (MC_TICK_CHECK)

View File

@@ -114,67 +114,47 @@ SUBSYSTEM_DEF(overlays)
#define NOT_QUEUED_ALREADY (!(flags_1 & OVERLAY_QUEUED_1)) #define NOT_QUEUED_ALREADY (!(flags_1 & OVERLAY_QUEUED_1))
#define QUEUE_FOR_COMPILE flags_1 |= OVERLAY_QUEUED_1; SSoverlays.queue += src; #define QUEUE_FOR_COMPILE flags_1 |= OVERLAY_QUEUED_1; SSoverlays.queue += src;
/atom/proc/cut_overlays(priority = FALSE) /atom/proc/cut_overlays()
LAZYINITLIST(priority_overlays)
LAZYINITLIST(remove_overlays) LAZYINITLIST(remove_overlays)
LAZYINITLIST(add_overlays) LAZYINITLIST(add_overlays)
remove_overlays = overlays.Copy() remove_overlays = overlays.Copy()
add_overlays.Cut() add_overlays.Cut()
if(priority)
priority_overlays.Cut()
//If not already queued for work and there are overlays to remove //If not already queued for work and there are overlays to remove
if(NOT_QUEUED_ALREADY && remove_overlays.len) if(NOT_QUEUED_ALREADY && remove_overlays.len)
QUEUE_FOR_COMPILE QUEUE_FOR_COMPILE
/atom/proc/cut_overlay(list/overlays, priority) /atom/proc/cut_overlay(list/overlays)
if(!overlays) if(!overlays)
return return
overlays = build_appearance_list(overlays) overlays = build_appearance_list(overlays)
LAZYINITLIST(add_overlays) //always initialized after this point LAZYINITLIST(add_overlays) //always initialized after this point
LAZYINITLIST(priority_overlays)
LAZYINITLIST(remove_overlays) LAZYINITLIST(remove_overlays)
var/a_len = add_overlays.len var/a_len = add_overlays.len
var/r_len = remove_overlays.len var/r_len = remove_overlays.len
var/p_len = priority_overlays.len
remove_overlays += overlays remove_overlays += overlays
add_overlays -= overlays add_overlays -= overlays
if(priority)
var/list/cached_priority = priority_overlays
LAZYREMOVE(cached_priority, overlays)
var/fa_len = add_overlays.len var/fa_len = add_overlays.len
var/fr_len = remove_overlays.len var/fr_len = remove_overlays.len
var/fp_len = priority_overlays.len
//If not already queued and there is work to be done //If not already queued and there is work to be done
if(NOT_QUEUED_ALREADY && (fa_len != a_len || fr_len != r_len || fp_len != p_len)) if(NOT_QUEUED_ALREADY && (fa_len != a_len || fr_len != r_len))
QUEUE_FOR_COMPILE QUEUE_FOR_COMPILE
/atom/proc/add_overlay(list/overlays, priority = FALSE) /atom/proc/add_overlay(list/overlays)
if(!overlays) if(!overlays)
return return
overlays = build_appearance_list(overlays) overlays = build_appearance_list(overlays)
LAZYINITLIST(add_overlays) //always initialized after this point LAZYINITLIST(add_overlays) //always initialized after this point
LAZYINITLIST(priority_overlays)
var/a_len = add_overlays.len var/a_len = add_overlays.len
var/p_len = priority_overlays.len
if(priority) add_overlays += overlays
priority_overlays += overlays //or in the image. Can we use [image] = image? var/fa_len = add_overlays.len
var/fp_len = priority_overlays.len if(NOT_QUEUED_ALREADY && fa_len != a_len)
if(NOT_QUEUED_ALREADY && fp_len != p_len) QUEUE_FOR_COMPILE
QUEUE_FOR_COMPILE
else
add_overlays += overlays
var/fa_len = add_overlays.len
if(NOT_QUEUED_ALREADY && fa_len != a_len)
QUEUE_FOR_COMPILE
/atom/proc/copy_overlays(atom/other, cut_old) //copys our_overlays from another atom /atom/proc/copy_overlays(atom/other, cut_old) //copys our_overlays from another atom
if(!other) if(!other)

View File

@@ -157,7 +157,7 @@
/datum/action/proc/ApplyIcon(obj/screen/movable/action_button/current_button, force = FALSE) /datum/action/proc/ApplyIcon(obj/screen/movable/action_button/current_button, force = FALSE)
if(icon_icon && button_icon_state && ((current_button.button_icon_state != button_icon_state) || force)) if(icon_icon && button_icon_state && ((current_button.button_icon_state != button_icon_state) || force))
current_button.cut_overlays(TRUE) current_button.cut_overlays()
current_button.add_overlay(mutable_appearance(icon_icon, button_icon_state)) current_button.add_overlay(mutable_appearance(icon_icon, button_icon_state))
current_button.button_icon_state = button_icon_state current_button.button_icon_state = button_icon_state

View File

@@ -119,7 +119,7 @@
UnregisterSignal(weapon, list(COMSIG_MOVABLE_MOVED, COMSIG_PARENT_QDELETING)) UnregisterSignal(weapon, list(COMSIG_MOVABLE_MOVED, COMSIG_PARENT_QDELETING))
if(overlay) if(overlay)
var/atom/A = parent var/atom/A = parent
A.cut_overlay(overlay, TRUE) UnregisterSignal(A,COMSIG_ATOM_UPDATE_OVERLAYS)
qdel(overlay) qdel(overlay)
return ..() return ..()
@@ -326,7 +326,8 @@
var/matrix/M = matrix() var/matrix/M = matrix()
M.Translate(pixelX, pixelY) M.Translate(pixelX, pixelY)
overlay.transform = M overlay.transform = M
hit.add_overlay(overlay, TRUE) RegisterSignal(hit,COMSIG_ATOM_UPDATE_OVERLAYS,.proc/apply_overlay)
hit.update_icon()
if(harmful) if(harmful)
hit.visible_message("<span class='danger'>[weapon] embeds itself in [hit]!</span>") hit.visible_message("<span class='danger'>[weapon] embeds itself in [hit]!</span>")
@@ -339,6 +340,8 @@
else else
hit.visible_message("<span class='danger'>[weapon] sticks itself to [hit]!</span>") hit.visible_message("<span class='danger'>[weapon] sticks itself to [hit]!</span>")
/datum/component/embedded/proc/apply_overlay(atom/source, list/overlay_list)
overlay_list += overlay
/datum/component/embedded/proc/examineTurf(datum/source, mob/user, list/examine_list) /datum/component/embedded/proc/examineTurf(datum/source, mob/user, list/examine_list)
if(harmful) if(harmful)

View File

@@ -14,6 +14,7 @@
var/mob/living/holder //who is currently benefiting from the shield. var/mob/living/holder //who is currently benefiting from the shield.
var/dissipating = FALSE //Is this shield meant to dissipate over time instead of recharging. var/dissipating = FALSE //Is this shield meant to dissipate over time instead of recharging.
var/del_on_overload = FALSE //will delete itself once it has no charges left. var/del_on_overload = FALSE //will delete itself once it has no charges left.
var/cached_vis_overlay //text identifier of the visual overlay.
/datum/component/shielded/Initialize(current, max = 3, delay = 20 SECONDS, rate = 1, slots, state = "shield-old", broken, \ /datum/component/shielded/Initialize(current, max = 3, delay = 20 SECONDS, rate = 1, slots, state = "shield-old", broken, \
sound = 'sound/magic/charge.ogg', end_sound = 'sound/machines/ding.ogg', diss = FALSE, del_overload = FALSE) sound = 'sound/magic/charge.ogg', end_sound = 'sound/machines/ding.ogg', diss = FALSE, del_overload = FALSE)
@@ -47,9 +48,8 @@
holder = L holder = L
var/to_add = charges >= 1 ? shield_state : broken_state var/to_add = charges >= 1 ? shield_state : broken_state
if(to_add) if(to_add)
var/mutable_appearance/M = mutable_appearance('icons/effects/effects.dmi', to_add) var/layer = (L.layer > MOB_LAYER ? L.layer : MOB_LAYER) + 0.01
M.layer = (L.layer > MOB_LAYER ? L.layer : MOB_LAYER) + 0.01 SSvis_overlays.add_vis_overlay(L, 'icons/effects/effects.dmi', to_add, layer, GAME_PLANE, L.dir)
holder.add_overlay(M, TRUE)
/datum/component/shielded/UnregisterFromParent() /datum/component/shielded/UnregisterFromParent()
. = ..() . = ..()
@@ -57,9 +57,9 @@
UnregisterSignal(parent, list(COMSIG_ITEM_RUN_BLOCK,COMSIG_ITEM_CHECK_BLOCK,COMSIG_ITEM_EQUIPPED,COMSIG_ITEM_DROPPED)) UnregisterSignal(parent, list(COMSIG_ITEM_RUN_BLOCK,COMSIG_ITEM_CHECK_BLOCK,COMSIG_ITEM_EQUIPPED,COMSIG_ITEM_DROPPED))
if(holder) if(holder)
UnregisterSignal(holder, list(COMSIG_LIVING_RUN_BLOCK, COMSIG_LIVING_GET_BLOCKING_ITEMS)) UnregisterSignal(holder, list(COMSIG_LIVING_RUN_BLOCK, COMSIG_LIVING_GET_BLOCKING_ITEMS))
var/to_remove = charges >= 1 ? shield_state : broken_state if(cached_vis_overlay)
if(to_remove) SSvis_overlays.remove_vis_overlay(holder, cached_vis_overlay)
holder.cut_overlay(mutable_appearance('icons/effects/effects.dmi', to_remove), TRUE) cached_vis_overlay = null
holder = null holder = null
/datum/component/shielded/process() /datum/component/shielded/process()
@@ -80,7 +80,7 @@
holder.visible_message("[holder]'s shield overloads!") holder.visible_message("[holder]'s shield overloads!")
qdel(src) qdel(src)
return return
if(holder && (old_charges < 1 && charges >= 1) || (!del_on_overload && old_charges >= 1 && charges < 1)) if(holder && ((old_charges < 1 && charges >= 1) || (!del_on_overload && old_charges >= 1 && charges < 1)))
update_shield_overlay(charges < 1) update_shield_overlay(charges < 1)
/datum/component/shielded/proc/adjust_charges(amount) /datum/component/shielded/proc/adjust_charges(amount)
@@ -93,20 +93,19 @@
holder.visible_message("[holder]'s shield overloads!") holder.visible_message("[holder]'s shield overloads!")
qdel(src) qdel(src)
return return
if(holder && (old_charges < 1 && charges >= 1) || (!del_on_overload && old_charges >= 1 && charges < 1)) if(holder && ((old_charges < 1 && charges >= 1) || (!del_on_overload && old_charges >= 1 && charges < 1)))
update_shield_overlay(charges < 1) update_shield_overlay(charges < 1)
/datum/component/shielded/proc/update_shield_overlay(broken) /datum/component/shielded/proc/update_shield_overlay(broken)
if(!holder) if(!holder)
return return
var/to_remove = broken ? shield_state : broken_state
var/to_add = broken ? broken_state : shield_state var/to_add = broken ? broken_state : shield_state
if(to_remove) if(cached_vis_overlay)
holder.cut_overlay(mutable_appearance('icons/effects/effects.dmi', to_remove), TRUE) SSvis_overlays.remove_vis_overlay(holder, cached_vis_overlay)
cached_vis_overlay = null
if(to_add) if(to_add)
var/mutable_appearance/M = mutable_appearance('icons/effects/effects.dmi', to_add) var/layer = (holder.layer > MOB_LAYER ? holder.layer : MOB_LAYER) + 0.01
M.layer = (holder.layer > MOB_LAYER ? holder.layer : MOB_LAYER) + 0.01 SSvis_overlays.add_vis_overlay(holder, 'icons/effects/effects.dmi', to_add, layer, GAME_PLANE, holder.dir)
holder.add_overlay(M, TRUE)
/datum/component/shielded/proc/on_equip(obj/item/source, mob/living/equipper, slot) /datum/component/shielded/proc/on_equip(obj/item/source, mob/living/equipper, slot)
if(!(accepted_slots & slotdefine2slotbit(slot))) if(!(accepted_slots & slotdefine2slotbit(slot)))
@@ -117,17 +116,16 @@
RegisterSignal(equipper, COMSIG_LIVING_GET_BLOCKING_ITEMS, .proc/include_shield) RegisterSignal(equipper, COMSIG_LIVING_GET_BLOCKING_ITEMS, .proc/include_shield)
var/to_add = charges >= 1 ? shield_state : broken_state var/to_add = charges >= 1 ? shield_state : broken_state
if(to_add) if(to_add)
var/mutable_appearance/M = mutable_appearance('icons/effects/effects.dmi', to_add) var/layer = (holder.layer > MOB_LAYER ? holder.layer : MOB_LAYER) + 0.01
M.layer = (holder.layer > MOB_LAYER ? holder.layer : MOB_LAYER) + 0.01 cached_vis_overlay = SSvis_overlays.add_vis_overlay(holder, 'icons/effects/effects.dmi', to_add, layer, GAME_PLANE, holder.dir)
equipper.add_overlay(M, TRUE)
/datum/component/shielded/proc/on_drop(obj/item/source, mob/dropper) /datum/component/shielded/proc/on_drop(obj/item/source, mob/dropper)
if(holder == dropper) if(holder == dropper)
UnregisterSignal(holder, COMSIG_LIVING_GET_BLOCKING_ITEMS) UnregisterSignal(holder, COMSIG_LIVING_GET_BLOCKING_ITEMS)
UnregisterSignal(parent, list(COMSIG_ITEM_RUN_BLOCK, COMSIG_ITEM_CHECK_BLOCK)) UnregisterSignal(parent, list(COMSIG_ITEM_RUN_BLOCK, COMSIG_ITEM_CHECK_BLOCK))
var/to_remove = charges >= 1 ? shield_state : broken_state if(cached_vis_overlay)
if(to_remove) SSvis_overlays.remove_vis_overlay(holder, cached_vis_overlay)
holder.cut_overlay(mutable_appearance('icons/effects/effects.dmi', to_remove), TRUE) cached_vis_overlay = null
holder = null holder = null
/datum/component/shielded/proc/include_shield(mob/source, list/items) /datum/component/shielded/proc/include_shield(mob/source, list/items)

View File

@@ -33,39 +33,34 @@
if(description) if(description)
RegisterSignal(A, COMSIG_PARENT_EXAMINE, .proc/examine) RegisterSignal(A, COMSIG_PARENT_EXAMINE, .proc/examine)
apply(A, TRUE)
num_decals_per_atom[A]++ num_decals_per_atom[A]++
apply(A)
/datum/element/decal/Detach(datum/target) /datum/element/decal/Detach(datum/target)
var/atom/A = target var/atom/A = target
remove(A, A.dir) num_decals_per_atom[A]--
UnregisterSignal(A, list(COMSIG_ATOM_DIR_CHANGE, COMSIG_COMPONENT_CLEAN_ACT, COMSIG_PARENT_EXAMINE)) apply(A, TRUE)
LAZYREMOVE(num_decals_per_atom, A) if(!num_decals_per_atom[A])
UnregisterSignal(A, list(COMSIG_ATOM_DIR_CHANGE, COMSIG_COMPONENT_CLEAN_ACT, COMSIG_PARENT_EXAMINE, COMSIG_ATOM_UPDATE_OVERLAYS))
LAZYREMOVE(num_decals_per_atom, A)
return ..() return ..()
/datum/element/decal/proc/remove(atom/target, old_dir) /datum/element/decal/proc/apply(atom/target, removing = FALSE)
pic.dir = first_dir == NORTH ? target.dir : turn(first_dir, dir2angle(old_dir)) if(num_decals_per_atom[target] == 1 && !removing)
for(var/i in 1 to num_decals_per_atom[target]) RegisterSignal(target, COMSIG_ATOM_UPDATE_OVERLAYS, .proc/apply_overlay, TRUE)
target.cut_overlay(pic, TRUE) target.update_icon()
if(isitem(target)) if(isitem(target))
addtimer(CALLBACK(target, /obj/item/.proc/update_slot_icon), 0, TIMER_UNIQUE) addtimer(CALLBACK(target, /obj/item/.proc/update_slot_icon), 0, TIMER_UNIQUE)
/datum/element/decal/proc/apply(atom/target, init = FALSE) /datum/element/decal/proc/apply_overlay(atom/source, list/overlay_list)
pic.dir = first_dir == NORTH ? target.dir : turn(first_dir, dir2angle(target.dir)) pic.dir = first_dir == NORTH ? source.dir : turn(first_dir, dir2angle(source.dir))
if(init) for(var/i in 1 to num_decals_per_atom[source])
target.add_overlay(pic, TRUE) overlay_list += pic
else
for(var/i in 1 to num_decals_per_atom[target])
target.add_overlay(pic, TRUE)
if(isitem(target))
addtimer(CALLBACK(target, /obj/item/.proc/update_slot_icon), 0, TIMER_UNIQUE)
/datum/element/decal/proc/rotate_react(datum/source, old_dir, new_dir) /datum/element/decal/proc/rotate_react(atom/source, old_dir, new_dir)
if(old_dir == new_dir) if(old_dir == new_dir)
return return
remove(source, old_dir) source.update_icon()
apply(source)
/datum/element/decal/proc/clean_react(datum/source, strength) /datum/element/decal/proc/clean_react(datum/source, strength)
if(strength >= cleanable) if(strength >= cleanable)

View File

@@ -26,7 +26,6 @@
var/list/atom_colours //used to store the different colors on an atom var/list/atom_colours //used to store the different colors on an atom
//its inherent color, the colored paint applied on it, special color effect etc... //its inherent color, the colored paint applied on it, special color effect etc...
var/list/priority_overlays //overlays that should remain on top and not normally removed when using cut_overlay functions, like c4.
var/list/remove_overlays // a very temporary list of overlays to remove var/list/remove_overlays // a very temporary list of overlays to remove
var/list/add_overlays // a very temporary list of overlays to add var/list/add_overlays // a very temporary list of overlays to add
@@ -145,7 +144,6 @@
qdel(reagents) qdel(reagents)
LAZYCLEARLIST(overlays) LAZYCLEARLIST(overlays)
LAZYCLEARLIST(priority_overlays)
for(var/i in targeted_by) for(var/i in targeted_by)
var/mob/M = i var/mob/M = i
@@ -1128,4 +1126,4 @@
* Override this if you want custom behaviour in whatever gets hit by the rust * Override this if you want custom behaviour in whatever gets hit by the rust
*/ */
/atom/proc/rust_heretic_act() /atom/proc/rust_heretic_act()
return return

View File

@@ -60,7 +60,8 @@
if(target) if(target)
if(!QDELETED(target)) if(!QDELETED(target))
location = get_turf(target) location = get_turf(target)
target.cut_overlay(plastic_overlay, TRUE) target.cut_overlay(plastic_overlay)
UnregisterSignal(target, COMSIG_ATOM_UPDATE_OVERLAYS, .proc/add_plastic_overlay)
if(!ismob(target) || full_damage_on_mobs) if(!ismob(target) || full_damage_on_mobs)
target.ex_act(EXPLODE_HEAVY, target) target.ex_act(EXPLODE_HEAVY, target)
else else
@@ -126,13 +127,17 @@
I.embedding["embed_chance"] = 0 I.embedding["embed_chance"] = 0
I.updateEmbedding() I.updateEmbedding()
target.add_overlay(plastic_overlay, TRUE) RegisterSignal(target, COMSIG_ATOM_UPDATE_OVERLAYS, .proc/add_plastic_overlay)
target.update_icon()
if(!nadeassembly) if(!nadeassembly)
to_chat(user, "<span class='notice'>You plant the bomb. Timer counting down from [det_time].</span>") to_chat(user, "<span class='notice'>You plant the bomb. Timer counting down from [det_time].</span>")
addtimer(CALLBACK(src, .proc/prime), det_time*10) addtimer(CALLBACK(src, .proc/prime), det_time*10)
else else
qdel(src) //How? qdel(src) //How?
/obj/item/grenade/plastic/proc/add_plastic_overlay(atom/source, list/overlay_list)
overlay_list += plastic_overlay
/obj/item/grenade/plastic/proc/shout_syndicate_crap(mob/M) /obj/item/grenade/plastic/proc/shout_syndicate_crap(mob/M)
if(!M) if(!M)
return return

View File

@@ -186,7 +186,7 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e
if(!acid_level) if(!acid_level)
SSacid.processing[src] = src SSacid.processing[src] = src
add_overlay(GLOB.acid_overlay, TRUE) update_icon()
var/acid_cap = acidpwr * 300 //so we cannot use huge amounts of weak acids to do as well as strong acids. var/acid_cap = acidpwr * 300 //so we cannot use huge amounts of weak acids to do as well as strong acids.
if(acid_level < acid_cap) if(acid_level < acid_cap)
acid_level = min(acid_level + acidpwr * acid_volume, acid_cap) acid_level = min(acid_level + acidpwr * acid_volume, acid_cap)
@@ -224,7 +224,7 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e
if(!(resistance_flags & ON_FIRE) && (resistance_flags & FLAMMABLE)) if(!(resistance_flags & ON_FIRE) && (resistance_flags & FLAMMABLE))
resistance_flags |= ON_FIRE resistance_flags |= ON_FIRE
SSfire_burning.processing[src] = src SSfire_burning.processing[src] = src
add_overlay(GLOB.fire_overlay, TRUE) update_icon()
return 1 return 1
//called when the obj is destroyed by fire //called when the obj is destroyed by fire
@@ -236,7 +236,7 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e
/obj/proc/extinguish() /obj/proc/extinguish()
if(resistance_flags & ON_FIRE) if(resistance_flags & ON_FIRE)
resistance_flags &= ~ON_FIRE resistance_flags &= ~ON_FIRE
cut_overlay(GLOB.fire_overlay, TRUE) update_icon()
SSfire_burning.processing -= src SSfire_burning.processing -= src
/obj/zap_act(power, zap_flags, shocked_targets) /obj/zap_act(power, zap_flags, shocked_targets)

View File

@@ -317,6 +317,13 @@
icon_state = unique_reskin[choice] icon_state = unique_reskin[choice]
to_chat(M, "[src] is now skinned as '[choice]'.") to_chat(M, "[src] is now skinned as '[choice]'.")
/obj/update_overlays()
. = ..()
if(acid_level)
. += GLOB.acid_overlay
if(resistance_flags & ON_FIRE)
. += GLOB.fire_overlay
//Called when the object is constructed by an autolathe //Called when the object is constructed by an autolathe
//Has a reference to the autolathe so you can do !!FUN!! things with hacked lathes //Has a reference to the autolathe so you can do !!FUN!! things with hacked lathes
/obj/proc/autolathe_crafted(obj/machinery/autolathe/A) /obj/proc/autolathe_crafted(obj/machinery/autolathe/A)

View File

@@ -118,8 +118,7 @@
// Set the clothing's integrity back to 100%, remove all damage to bodyparts, and generally fix it up // Set the clothing's integrity back to 100%, remove all damage to bodyparts, and generally fix it up
/obj/item/clothing/proc/repair(mob/user, params) /obj/item/clothing/proc/repair(mob/user, params)
damaged_clothes = CLOTHING_PRISTINE update_clothes_damaged_state(CLOTHING_PRISTINE)
update_clothes_damaged_state(FALSE)
obj_integrity = max_integrity obj_integrity = max_integrity
name = initial(name) // remove "tattered" or "shredded" if there's a prefix name = initial(name) // remove "tattered" or "shredded" if there's a prefix
body_parts_covered = initial(body_parts_covered) body_parts_covered = initial(body_parts_covered)
@@ -196,7 +195,7 @@
if(3 to INFINITY) // take better care of your shit, dude if(3 to INFINITY) // take better care of your shit, dude
name = "tattered [initial(name)]" name = "tattered [initial(name)]"
update_clothes_damaged_state() update_clothes_damaged_state(CLOTHING_DAMAGED)
/obj/item/clothing/Destroy() /obj/item/clothing/Destroy()
user_vars_remembered = null //Oh god somebody put REFERENCES in here? not to worry, we'll clean it up user_vars_remembered = null //Oh god somebody put REFERENCES in here? not to worry, we'll clean it up
@@ -257,7 +256,7 @@
how_cool_are_your_threads += "Adding or removing items from [src] makes no noise.\n" how_cool_are_your_threads += "Adding or removing items from [src] makes no noise.\n"
how_cool_are_your_threads += "</span>" how_cool_are_your_threads += "</span>"
. += how_cool_are_your_threads.Join() . += how_cool_are_your_threads.Join()
if(LAZYLEN(armor_list)) if(LAZYLEN(armor_list))
armor_list.Cut() armor_list.Cut()
if(armor.bio) if(armor.bio)
@@ -346,10 +345,16 @@
var/mob/M = loc var/mob/M = loc
to_chat(M, "<span class='warning'>Your [name] starts to fall apart!</span>") to_chat(M, "<span class='warning'>Your [name] starts to fall apart!</span>")
/obj/item/clothing/proc/update_clothes_damaged_state(damaging = TRUE) //This mostly exists so subtypes can call appriopriate update icon calls on the wearer.
var/index = "[REF(initial(icon))]-[initial(icon_state)]" /obj/item/clothing/proc/update_clothes_damaged_state(damaged_state = CLOTHING_DAMAGED)
var/static/list/damaged_clothes_icons = list() damaged_clothes = damaged_state
if(damaging) update_icon()
/obj/item/clothing/update_overlays()
. = ..()
if(damaged_clothes)
var/index = "[REF(initial(icon))]-[initial(icon_state)]"
var/static/list/damaged_clothes_icons = list()
var/icon/damaged_clothes_icon = damaged_clothes_icons[index] var/icon/damaged_clothes_icon = damaged_clothes_icons[index]
if(!damaged_clothes_icon) if(!damaged_clothes_icon)
damaged_clothes_icon = icon(initial(icon), initial(icon_state), , 1) //we only want to apply damaged effect to the initial icon_state for each object damaged_clothes_icon = icon(initial(icon), initial(icon_state), , 1) //we only want to apply damaged effect to the initial icon_state for each object
@@ -357,9 +362,7 @@
damaged_clothes_icon.Blend(icon('icons/effects/item_damage.dmi', "itemdamaged"), ICON_MULTIPLY) //adds damage effect and the remaining white areas become transparant damaged_clothes_icon.Blend(icon('icons/effects/item_damage.dmi', "itemdamaged"), ICON_MULTIPLY) //adds damage effect and the remaining white areas become transparant
damaged_clothes_icon = fcopy_rsc(damaged_clothes_icon) damaged_clothes_icon = fcopy_rsc(damaged_clothes_icon)
damaged_clothes_icons[index] = damaged_clothes_icon damaged_clothes_icons[index] = damaged_clothes_icon
add_overlay(damaged_clothes_icon, TRUE) . += damaged_clothes_icon
else
cut_overlay(damaged_clothes_icons[index], TRUE)
/* /*
SEE_SELF // can see self, no matter what SEE_SELF // can see self, no matter what

View File

@@ -21,7 +21,7 @@ INITIALIZE_IMMEDIATE(/mob/living/carbon/human/dummy)
/mob/living/carbon/human/dummy/proc/wipe_state() /mob/living/carbon/human/dummy/proc/wipe_state()
delete_equipment() delete_equipment()
icon_render_key = null icon_render_key = null
cut_overlays(TRUE) cut_overlays()
//Inefficient pooling/caching way. //Inefficient pooling/caching way.
GLOBAL_LIST_EMPTY(human_dummy_list) GLOBAL_LIST_EMPTY(human_dummy_list)

View File

@@ -58,7 +58,7 @@
eyes_overlay.pixel_y = -8 eyes_overlay.pixel_y = -8
moustache_overlay.pixel_y = -8 moustache_overlay.pixel_y = -8
cut_overlays(TRUE) cut_overlays()
add_overlay(body_overlay) add_overlay(body_overlay)
add_overlay(eyes_overlay) add_overlay(eyes_overlay)
add_overlay(moustache_overlay) add_overlay(moustache_overlay)

View File

@@ -62,7 +62,8 @@
var/no_pin_required = FALSE //whether the gun can be fired without a pin var/no_pin_required = FALSE //whether the gun can be fired without a pin
var/obj/item/flashlight/gun_light var/obj/item/flashlight/gun_light
var/can_flashlight = 0 var/can_flashlight = FALSE
var/gunlight_state = "flight"
var/obj/item/kitchen/knife/bayonet var/obj/item/kitchen/knife/bayonet
var/mutable_appearance/knife_overlay var/mutable_appearance/knife_overlay
var/can_bayonet = FALSE var/can_bayonet = FALSE
@@ -417,14 +418,7 @@
return return
to_chat(user, "<span class='notice'>You attach \the [K] to the front of \the [src].</span>") to_chat(user, "<span class='notice'>You attach \the [K] to the front of \the [src].</span>")
bayonet = K bayonet = K
var/state = "bayonet" //Generic state. update_icon()
if(bayonet.icon_state in icon_states('icons/obj/guns/bayonets.dmi')) //Snowflake state?
state = bayonet.icon_state
var/icon/bayonet_icons = 'icons/obj/guns/bayonets.dmi'
knife_overlay = mutable_appearance(bayonet_icons, state)
knife_overlay.pixel_x = knife_x_offset
knife_overlay.pixel_y = knife_y_offset
add_overlay(knife_overlay, TRUE)
else if(istype(I, /obj/item/screwdriver)) else if(istype(I, /obj/item/screwdriver))
if(gun_light) if(gun_light)
var/obj/item/flashlight/seclite/S = gun_light var/obj/item/flashlight/seclite/S = gun_light
@@ -439,8 +433,7 @@
var/obj/item/kitchen/knife/K = bayonet var/obj/item/kitchen/knife/K = bayonet
K.forceMove(get_turf(user)) K.forceMove(get_turf(user))
bayonet = null bayonet = null
cut_overlay(knife_overlay, TRUE) update_icon()
knife_overlay = null
else else
return ..() return ..()
@@ -468,22 +461,35 @@
set_light(gun_light.brightness_on, gun_light.flashlight_power, gun_light.light_color) set_light(gun_light.brightness_on, gun_light.flashlight_power, gun_light.light_color)
else else
set_light(0) set_light(0)
cut_overlays(flashlight_overlay, TRUE) else
var/state = "flight[gun_light.on? "_on":""]" //Generic state. set_light(0)
update_icon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/gun/update_overlays()
. = ..()
if(gun_light)
var/mutable_appearance/flashlight_overlay
var/state = "[gunlight_state][gun_light.on? "_on":""]" //Generic state.
if(gun_light.icon_state in icon_states('icons/obj/guns/flashlights.dmi')) //Snowflake state? if(gun_light.icon_state in icon_states('icons/obj/guns/flashlights.dmi')) //Snowflake state?
state = gun_light.icon_state state = gun_light.icon_state
flashlight_overlay = mutable_appearance('icons/obj/guns/flashlights.dmi', state) flashlight_overlay = mutable_appearance('icons/obj/guns/flashlights.dmi', state)
flashlight_overlay.pixel_x = flight_x_offset flashlight_overlay.pixel_x = flight_x_offset
flashlight_overlay.pixel_y = flight_y_offset flashlight_overlay.pixel_y = flight_y_offset
add_overlay(flashlight_overlay, TRUE) . += flashlight_overlay
else
set_light(0) if(bayonet)
cut_overlays(flashlight_overlay, TRUE) var/mutable_appearance/knife_overlay
flashlight_overlay = null var/state = "bayonet" //Generic state.
update_icon(TRUE) if(bayonet.icon_state in icon_states('icons/obj/guns/bayonets.dmi')) //Snowflake state?
for(var/X in actions) state = bayonet.icon_state
var/datum/action/A = X var/icon/bayonet_icons = 'icons/obj/guns/bayonets.dmi'
A.UpdateButtonIcon() knife_overlay = mutable_appearance(bayonet_icons, state)
knife_overlay.pixel_x = knife_x_offset
knife_overlay.pixel_y = knife_y_offset
. += knife_overlay
/obj/item/gun/item_action_slot_check(slot, mob/user, datum/action/A) /obj/item/gun/item_action_slot_check(slot, mob/user, datum/action/A)
if(istype(A, /datum/action/item_action/toggle_scope_zoom) && slot != SLOT_HANDS) if(istype(A, /datum/action/item_action/toggle_scope_zoom) && slot != SLOT_HANDS)

View File

@@ -18,13 +18,15 @@
/obj/item/gun/ballistic/automatic/proto/unrestricted /obj/item/gun/ballistic/automatic/proto/unrestricted
pin = /obj/item/firing_pin pin = /obj/item/firing_pin
/obj/item/gun/ballistic/automatic/update_icon() /obj/item/gun/ballistic/automatic/update_overlays()
..() . = ..()
if(automatic_burst_overlay) if(automatic_burst_overlay)
if(!select) if(!select)
add_overlay("[initial(icon_state)]semi") . += ("[initial(icon_state)]semi")
if(select == 1) if(select == 1)
add_overlay("[initial(icon_state)]burst") . += "[initial(icon_state)]burst"
/obj/item/gun/ballistic/automatic/update_icon_state()
icon_state = "[initial(icon_state)][magazine ? "-[magazine.max_ammo]" : ""][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]" icon_state = "[initial(icon_state)][magazine ? "-[magazine.max_ammo]" : ""][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
/obj/item/gun/ballistic/automatic/attackby(obj/item/A, mob/user, params) /obj/item/gun/ballistic/automatic/attackby(obj/item/A, mob/user, params)
@@ -115,8 +117,7 @@
. = ..() . = ..()
empty_alarm() empty_alarm()
/obj/item/gun/ballistic/automatic/c20r/update_icon() /obj/item/gun/ballistic/automatic/c20r/update_icon_state()
..()
icon_state = "c20r[magazine ? "-[CEILING(get_ammo(0)/4, 1)*4]" : ""][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]" icon_state = "c20r[magazine ? "-[CEILING(get_ammo(0)/4, 1)*4]" : ""][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
/obj/item/gun/ballistic/automatic/wt550 /obj/item/gun/ballistic/automatic/wt550
@@ -141,9 +142,8 @@
. = ..() . = ..()
spread = 0 spread = 0
/obj/item/gun/ballistic/automatic/wt550/update_icon() /obj/item/gun/ballistic/automatic/wt550/update_icon_state()
..() icon_state = "wt550[magazine ? "-[CEILING(((get_ammo(FALSE) / magazine.max_ammo) * 20) /4, 1)*4]" : "-0"]" //Sprites only support up to 20.
icon_state = "wt550[magazine ? "-[CEILING(( (get_ammo(FALSE) / magazine.max_ammo) * 20) /4, 1)*4]" : "-0"]" //Sprites only support up to 20.
/obj/item/gun/ballistic/automatic/mini_uzi /obj/item/gun/ballistic/automatic/mini_uzi
name = "\improper Type U3 Uzi" name = "\improper Type U3 Uzi"
@@ -160,6 +160,7 @@
mag_type = /obj/item/ammo_box/magazine/m556 mag_type = /obj/item/ammo_box/magazine/m556
fire_sound = 'sound/weapons/gunshot_smg.ogg' fire_sound = 'sound/weapons/gunshot_smg.ogg'
can_suppress = FALSE can_suppress = FALSE
automatic_burst_overlay = FALSE
var/obj/item/gun/ballistic/revolver/grenadelauncher/underbarrel var/obj/item/gun/ballistic/revolver/grenadelauncher/underbarrel
burst_size = 3 burst_size = 3
burst_shot_delay = 2 burst_shot_delay = 2
@@ -191,18 +192,19 @@
underbarrel.attackby(A, user, params) underbarrel.attackby(A, user, params)
else else
..() ..()
/obj/item/gun/ballistic/automatic/m90/update_icon() /obj/item/gun/ballistic/automatic/m90/update_overlays()
..() . = ..()
cut_overlays()
switch(select) switch(select)
if(0) if(0)
add_overlay("[initial(icon_state)]semi") . += "[initial(icon_state)]semi"
if(1) if(1)
add_overlay("[initial(icon_state)]burst") . += "[initial(icon_state)]burst"
if(2) if(2)
add_overlay("[initial(icon_state)]gren") . += "[initial(icon_state)]gren"
/obj/item/gun/ballistic/automatic/m90/update_icon_state()
icon_state = "[initial(icon_state)][magazine ? "" : "-e"]" icon_state = "[initial(icon_state)][magazine ? "" : "-e"]"
return
/obj/item/gun/ballistic/automatic/m90/burst_select() /obj/item/gun/ballistic/automatic/m90/burst_select()
var/mob/living/carbon/human/user = usr var/mob/living/carbon/human/user = usr
switch(select) switch(select)
@@ -257,6 +259,7 @@
weapon_weight = WEAPON_MEDIUM weapon_weight = WEAPON_MEDIUM
mag_type = /obj/item/ammo_box/magazine/m12g mag_type = /obj/item/ammo_box/magazine/m12g
fire_sound = 'sound/weapons/gunshot.ogg' fire_sound = 'sound/weapons/gunshot.ogg'
automatic_burst_overlay = FALSE
can_suppress = FALSE can_suppress = FALSE
burst_size = 1 burst_size = 1
pin = /obj/item/firing_pin/implant/pindicate pin = /obj/item/firing_pin/implant/pindicate
@@ -269,10 +272,13 @@
. = ..() . = ..()
update_icon() update_icon()
/obj/item/gun/ballistic/automatic/shotgun/bulldog/update_icon() /obj/item/gun/ballistic/automatic/shotgun/bulldog/update_icon_state()
cut_overlays() return
/obj/item/gun/ballistic/automatic/shotgun/bulldog/update_overlays()
. = ..()
if(magazine) if(magazine)
add_overlay("[magazine.icon_state]") . += "[magazine.icon_state]"
icon_state = "bulldog[chambered ? "" : "-e"]" icon_state = "bulldog[chambered ? "" : "-e"]"
/obj/item/gun/ballistic/automatic/shotgun/bulldog/afterattack() /obj/item/gun/ballistic/automatic/shotgun/bulldog/afterattack()
@@ -298,6 +304,7 @@
burst_shot_delay = 1 burst_shot_delay = 1
spread = 7 spread = 7
pin = /obj/item/firing_pin/implant/pindicate pin = /obj/item/firing_pin/implant/pindicate
automatic_burst_overlay = FALSE
/obj/item/gun/ballistic/automatic/l6_saw/unrestricted /obj/item/gun/ballistic/automatic/l6_saw/unrestricted
pin = /obj/item/firing_pin pin = /obj/item/firing_pin
@@ -316,7 +323,7 @@
playsound(user, 'sound/weapons/sawclose.ogg', 60, 1) playsound(user, 'sound/weapons/sawclose.ogg', 60, 1)
update_icon() update_icon()
/obj/item/gun/ballistic/automatic/l6_saw/update_icon() /obj/item/gun/ballistic/automatic/l6_saw/update_icon_state()
icon_state = "l6[cover_open ? "open" : "closed"][magazine ? CEILING(get_ammo(0)/12.5, 1)*25 : "-empty"][suppressed ? "-suppressed" : ""]" icon_state = "l6[cover_open ? "open" : "closed"][magazine ? CEILING(get_ammo(0)/12.5, 1)*25 : "-empty"][suppressed ? "-suppressed" : ""]"
item_state = "l6[cover_open ? "openmag" : "closedmag"]" item_state = "l6[cover_open ? "openmag" : "closedmag"]"
@@ -369,9 +376,10 @@
zoom_amt = 10 //Long range, enough to see in front of you, but no tiles behind you. zoom_amt = 10 //Long range, enough to see in front of you, but no tiles behind you.
zoom_out_amt = 13 zoom_out_amt = 13
slot_flags = ITEM_SLOT_BACK slot_flags = ITEM_SLOT_BACK
automatic_burst_overlay = FALSE
actions_types = list() actions_types = list()
/obj/item/gun/ballistic/automatic/sniper_rifle/update_icon() /obj/item/gun/ballistic/automatic/sniper_rifle/update_icon_state()
if(magazine) if(magazine)
icon_state = "sniper-mag" icon_state = "sniper-mag"
else else
@@ -397,9 +405,10 @@
can_suppress = TRUE can_suppress = TRUE
w_class = WEIGHT_CLASS_HUGE w_class = WEIGHT_CLASS_HUGE
slot_flags = ITEM_SLOT_BACK slot_flags = ITEM_SLOT_BACK
automatic_burst_overlay = FALSE
actions_types = list() actions_types = list()
/obj/item/gun/ballistic/automatic/surplus/update_icon() /obj/item/gun/ballistic/automatic/surplus/update_icon_state()
if(magazine) if(magazine)
icon_state = "surplus" icon_state = "surplus"
else else
@@ -413,6 +422,7 @@
icon_state = "oldrifle" icon_state = "oldrifle"
item_state = "arg" item_state = "arg"
mag_type = /obj/item/ammo_box/magazine/recharge mag_type = /obj/item/ammo_box/magazine/recharge
automatic_burst_overlay = FALSE
fire_delay = 2 fire_delay = 2
can_suppress = FALSE can_suppress = FALSE
burst_size = 1 burst_size = 1
@@ -420,7 +430,5 @@
fire_sound = 'sound/weapons/laser.ogg' fire_sound = 'sound/weapons/laser.ogg'
casing_ejector = FALSE casing_ejector = FALSE
/obj/item/gun/ballistic/automatic/laser/update_icon() /obj/item/gun/ballistic/automatic/laser/update_icon_state()
..()
icon_state = "oldrifle[magazine ? "-[CEILING(get_ammo(0)/4, 1)*4]" : ""]" icon_state = "oldrifle[magazine ? "-[CEILING(get_ammo(0)/4, 1)*4]" : ""]"
return

View File

@@ -42,8 +42,7 @@
actions_types = list() actions_types = list()
casing_ejector = FALSE casing_ejector = FALSE
/obj/item/gun/ballistic/automatic/gyropistol/update_icon() /obj/item/gun/ballistic/automatic/gyropistol/update_icon_state()
..()
icon_state = "[initial(icon_state)][magazine ? "loaded" : ""]" icon_state = "[initial(icon_state)][magazine ? "loaded" : ""]"
/obj/item/gun/ballistic/automatic/speargun /obj/item/gun/ballistic/automatic/speargun
@@ -54,6 +53,7 @@
w_class = WEIGHT_CLASS_BULKY w_class = WEIGHT_CLASS_BULKY
force = 10 force = 10
can_suppress = FALSE can_suppress = FALSE
automatic_burst_overlay = FALSE
mag_type = /obj/item/ammo_box/magazine/internal/speargun mag_type = /obj/item/ammo_box/magazine/internal/speargun
fire_sound = 'sound/weapons/grenadelaunch.ogg' fire_sound = 'sound/weapons/grenadelaunch.ogg'
burst_size = 1 burst_size = 1
@@ -62,8 +62,9 @@
actions_types = list() actions_types = list()
casing_ejector = FALSE casing_ejector = FALSE
/obj/item/gun/ballistic/automatic/speargun/update_icon() /obj/item/gun/ballistic/automatic/speargun/ComponentInitialize()
return . = ..()
AddElement(/datum/element/update_icon_blocker)
/obj/item/gun/ballistic/automatic/speargun/attack_self() /obj/item/gun/ballistic/automatic/speargun/attack_self()
return return
@@ -137,7 +138,7 @@
chamber_round() chamber_round()
update_icon() update_icon()
/obj/item/gun/ballistic/rocketlauncher/update_icon() /obj/item/gun/ballistic/rocketlauncher/update_icon_state()
icon_state = "[initial(icon_state)]-[chambered ? "1" : "0"]" icon_state = "[initial(icon_state)]-[chambered ? "1" : "0"]"
/obj/item/gun/ballistic/rocketlauncher/suicide_act(mob/living/user) /obj/item/gun/ballistic/rocketlauncher/suicide_act(mob/living/user)

View File

@@ -75,8 +75,7 @@
recoil = 2 recoil = 2
weapon_weight = WEAPON_HEAVY weapon_weight = WEAPON_HEAVY
/obj/item/gun/ballistic/automatic/magrifle/hyperburst/update_icon() /obj/item/gun/ballistic/automatic/magrifle/hyperburst/update_icon_state()
..()
icon_state = "hyperburst[magazine ? "-[get_ammo()]" : ""][chambered ? "" : "-e"]" icon_state = "hyperburst[magazine ? "-[get_ammo()]" : ""][chambered ? "" : "-e"]"
///magpistol/// ///magpistol///
@@ -92,12 +91,14 @@
fire_delay = 2 fire_delay = 2
inaccuracy_modifier = 0.25 inaccuracy_modifier = 0.25
cell_type = /obj/item/stock_parts/cell/magnetic/pistol cell_type = /obj/item/stock_parts/cell/magnetic/pistol
automatic_burst_overlay = FALSE
/obj/item/gun/ballistic/automatic/magrifle/pistol/update_icon() /obj/item/gun/ballistic/automatic/magrifle/pistol/update_overlays()
..() . = ..()
cut_overlays()
if(magazine) if(magazine)
add_overlay("magpistol-magazine") . += "magpistol-magazine"
/obj/item/gun/ballistic/automatic/magrifle/pistol/update_icon_state()
icon_state = "[initial(icon_state)][chambered ? "" : "-e"]" icon_state = "[initial(icon_state)][chambered ? "" : "-e"]"
/obj/item/gun/ballistic/automatic/magrifle/pistol/nopin /obj/item/gun/ballistic/automatic/magrifle/pistol/nopin

View File

@@ -8,12 +8,12 @@
burst_size = 1 burst_size = 1
fire_delay = 0 fire_delay = 0
actions_types = list() actions_types = list()
automatic_burst_overlay = FALSE
/obj/item/gun/ballistic/automatic/pistol/no_mag /obj/item/gun/ballistic/automatic/pistol/no_mag
spawnwithmagazine = FALSE spawnwithmagazine = FALSE
/obj/item/gun/ballistic/automatic/pistol/update_icon() /obj/item/gun/ballistic/automatic/pistol/update_icon_state()
..()
icon_state = "[initial(icon_state)][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]" icon_state = "[initial(icon_state)][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
/obj/item/gun/ballistic/automatic/pistol/suppressed/Initialize(mapload) /obj/item/gun/ballistic/automatic/pistol/suppressed/Initialize(mapload)
@@ -28,6 +28,7 @@
icon = 'modular_citadel/icons/obj/guns/cit_guns.dmi' icon = 'modular_citadel/icons/obj/guns/cit_guns.dmi'
icon_state = "cde" icon_state = "cde"
can_unsuppress = TRUE can_unsuppress = TRUE
automatic_burst_overlay = FALSE
obj_flags = UNIQUE_RENAME obj_flags = UNIQUE_RENAME
unique_reskin = list("Default" = "cde", unique_reskin = list("Default" = "cde",
"N-99" = "n99", "N-99" = "n99",
@@ -38,20 +39,18 @@
"PX4 Storm" = "px4" "PX4 Storm" = "px4"
) )
/obj/item/gun/ballistic/automatic/pistol/modular/update_icon() /obj/item/gun/ballistic/automatic/pistol/modular/update_icon_state()
..()
if(current_skin) if(current_skin)
icon_state = "[unique_reskin[current_skin]][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]" icon_state = "[unique_reskin[current_skin]][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
else else
icon_state = "[initial(icon_state)][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]" icon_state = "[initial(icon_state)][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
/obj/item/gun/ballistic/automatic/pistol/modular/update_overlays()
. = ..()
if(magazine && suppressed) if(magazine && suppressed)
cut_overlays() . += "[unique_reskin[current_skin]]-magazine-sup" //Yes, this means the default iconstate can't have a magazine overlay
add_overlay("[unique_reskin[current_skin]]-magazine-sup") //Yes, this means the default iconstate can't have a magazine overlay
else if (magazine) else if (magazine)
cut_overlays() . += "[unique_reskin[current_skin]]-magazine"
add_overlay("[unique_reskin[current_skin]]-magazine")
else
cut_overlays()
/obj/item/gun/ballistic/automatic/pistol/m1911 /obj/item/gun/ballistic/automatic/pistol/m1911
name = "\improper M1911" name = "\improper M1911"
@@ -77,14 +76,14 @@
force = 14 force = 14
mag_type = /obj/item/ammo_box/magazine/m50 mag_type = /obj/item/ammo_box/magazine/m50
can_suppress = FALSE can_suppress = FALSE
automatic_burst_overlay = FALSE
/obj/item/gun/ballistic/automatic/pistol/deagle/update_icon() /obj/item/gun/ballistic/automatic/pistol/deagle/update_overlays()
..() . = ..()
if(magazine) if(magazine)
cut_overlays() . += "deagle_magazine"
add_overlay("deagle_magazine")
else /obj/item/gun/ballistic/automatic/pistol/deagle/update_icon_state()
cut_overlays()
icon_state = "[initial(icon_state)][chambered ? "" : "-e"]" icon_state = "[initial(icon_state)][chambered ? "" : "-e"]"
/obj/item/gun/ballistic/automatic/pistol/deagle/gold /obj/item/gun/ballistic/automatic/pistol/deagle/gold
@@ -142,14 +141,14 @@
actions_types = list() actions_types = list()
fire_sound = 'sound/weapons/blastcannon.ogg' fire_sound = 'sound/weapons/blastcannon.ogg'
spread = 20 //damn thing has no rifling. spread = 20 //damn thing has no rifling.
automatic_burst_overlay = FALSE
/obj/item/gun/ballistic/automatic/pistol/antitank/update_icon() /obj/item/gun/ballistic/automatic/pistol/antitank/update_overlays()
..() . = ..()
if(magazine) if(magazine)
cut_overlays() . += "atp-mag"
add_overlay("atp-mag")
else /obj/item/gun/ballistic/automatic/pistol/antitank/update_icon_state()
cut_overlays()
icon_state = "[initial(icon_state)][chambered ? "" : "-e"]" icon_state = "[initial(icon_state)][chambered ? "" : "-e"]"
/obj/item/gun/ballistic/automatic/pistol/antitank/syndicate /obj/item/gun/ballistic/automatic/pistol/antitank/syndicate

View File

@@ -348,10 +348,10 @@
else else
to_chat(user, "<span class='warning'>You need at least ten lengths of cable if you want to make a sling!</span>") to_chat(user, "<span class='warning'>You need at least ten lengths of cable if you want to make a sling!</span>")
/obj/item/gun/ballistic/revolver/doublebarrel/improvised/update_icon() /obj/item/gun/ballistic/revolver/doublebarrel/improvised/update_overlays()
..() . = ..()
if(slung) if(slung)
icon_state += "sling" . += "[icon_state]sling"
/obj/item/gun/ballistic/revolver/doublebarrel/improvised/sawoff(mob/user) /obj/item/gun/ballistic/revolver/doublebarrel/improvised/sawoff(mob/user)
. = ..() . = ..()

View File

@@ -164,10 +164,10 @@
else else
to_chat(user, "<span class='warning'>You need at least ten lengths of cable if you want to make a sling!</span>") to_chat(user, "<span class='warning'>You need at least ten lengths of cable if you want to make a sling!</span>")
/obj/item/gun/ballistic/shotgun/boltaction/improvised/update_icon() /obj/item/gun/ballistic/shotgun/boltaction/improvised/update_overlays()
..() . = ..()
if(slung) if(slung)
icon_state += "sling" . += "[icon_state]sling"
/obj/item/gun/ballistic/shotgun/boltaction/enchanted /obj/item/gun/ballistic/shotgun/boltaction/enchanted
name = "enchanted bolt action rifle" name = "enchanted bolt action rifle"
@@ -272,7 +272,7 @@
spread = 2 spread = 2
update_icon() update_icon()
/obj/item/gun/ballistic/shotgun/automatic/combat/compact/update_icon() /obj/item/gun/ballistic/shotgun/automatic/combat/compact/update_icon_state()
icon_state = "[current_skin ? unique_reskin[current_skin] : "cshotgun"][stock ? "" : "c"]" icon_state = "[current_skin ? unique_reskin[current_skin] : "cshotgun"][stock ? "" : "c"]"
//Dual Feed Shotgun //Dual Feed Shotgun

View File

@@ -27,9 +27,9 @@
burst_size = 1 burst_size = 1
fire_delay = 0 fire_delay = 0
actions_types = list() actions_types = list()
automatic_burst_overlay = FALSE
/obj/item/gun/ballistic/automatic/toy/pistol/update_icon() /obj/item/gun/ballistic/automatic/toy/pistol/update_icon_state()
..()
icon_state = "[initial(icon_state)][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]" icon_state = "[initial(icon_state)][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
/obj/item/gun/ballistic/automatic/toy/pistol/riot /obj/item/gun/ballistic/automatic/toy/pistol/riot

View File

@@ -29,7 +29,6 @@
var/charge_sections = 4 var/charge_sections = 4
ammo_x_offset = 2 ammo_x_offset = 2
var/shaded_charge = FALSE //if this gun uses a stateful charge bar for more detail var/shaded_charge = FALSE //if this gun uses a stateful charge bar for more detail
var/old_ratio = 0 // stores the gun's previous ammo "ratio" to see if it needs an updated icon
var/selfcharge = EGUN_NO_SELFCHARGE // EGUN_SELFCHARGE if true, EGUN_SELFCHARGE_BORG drains the cyborg's cell to recharge its own var/selfcharge = EGUN_NO_SELFCHARGE // EGUN_SELFCHARGE if true, EGUN_SELFCHARGE_BORG drains the cyborg's cell to recharge its own
var/charge_tick = 0 var/charge_tick = 0
var/charge_delay = 4 var/charge_delay = 4
@@ -64,10 +63,20 @@
START_PROCESSING(SSobj, src) START_PROCESSING(SSobj, src)
update_icon() update_icon()
/obj/item/gun/energy/ComponentInitialize()
. = ..()
AddElement(/datum/element/update_icon_updates_onmob)
/obj/item/gun/energy/Destroy() /obj/item/gun/energy/Destroy()
STOP_PROCESSING(SSobj, src) STOP_PROCESSING(SSobj, src)
return ..() return ..()
/obj/item/gun/energy/handle_atom_del(atom/A)
if(A == cell)
cell = null
update_icon()
return ..()
/obj/item/gun/energy/examine(mob/user) /obj/item/gun/energy/examine(mob/user)
. = ..() . = ..()
if(!right_click_overridden) if(!right_click_overridden)
@@ -226,46 +235,47 @@
#undef DECREMENT_OR_WRAP #undef DECREMENT_OR_WRAP
#undef IS_VALID_INDEX #undef IS_VALID_INDEX
/obj/item/gun/energy/update_icon(force_update) /obj/item/gun/energy/update_icon_state()
if(initial(item_state))
return
..()
var/ratio = get_charge_ratio()
var/new_item_state = ""
new_item_state = initial(icon_state)
if(modifystate)
var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index]
new_item_state += "[shot.select_name]"
new_item_state += "[ratio]"
item_state = new_item_state
/obj/item/gun/energy/update_overlays()
if(QDELETED(src)) if(QDELETED(src))
return return
..() ..()
if(!automatic_charge_overlays) if(!automatic_charge_overlays)
return return
var/ratio = can_shoot() ? CEILING(clamp(cell.charge / cell.maxcharge, 0, 1) * charge_sections, 1) : 0 var/overlay_icon_state = "[icon_state]_charge"
// Sets the ratio to 0 if the gun doesn't have enough charge to fire, or if it's power cell is removed. var/ratio = get_charge_ratio()
// TG issues #5361 & #47908
if(ratio == old_ratio && !force_update)
return
old_ratio = ratio
cut_overlays()
var/iconState = "[icon_state]_charge"
var/itemState = null
if(!initial(item_state))
itemState = icon_state
if (modifystate) if (modifystate)
var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index] var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index]
add_overlay("[icon_state]_[shot.select_name]") . += "[icon_state]_[shot.select_name]"
iconState += "_[shot.select_name]" overlay_icon_state += "_[shot.select_name]"
if(itemState)
itemState += "[shot.select_name]"
if(ratio == 0) if(ratio == 0)
add_overlay("[icon_state]_empty") . += "[icon_state]_empty"
else else
if(!shaded_charge) if(!shaded_charge)
var/mutable_appearance/charge_overlay = mutable_appearance(icon, iconState) var/mutable_appearance/charge_overlay = mutable_appearance(icon, overlay_icon_state)
for(var/i = ratio, i >= 1, i--) for(var/i = ratio, i >= 1, i--)
charge_overlay.pixel_x = ammo_x_offset * (i - 1) charge_overlay.pixel_x = ammo_x_offset * (i - 1)
charge_overlay.pixel_y = ammo_y_offset * (i - 1) charge_overlay.pixel_y = ammo_y_offset * (i - 1)
add_overlay(charge_overlay) . += charge_overlay
else else
add_overlay("[icon_state]_charge[ratio]") . += "[icon_state]_charge[ratio]"
if(itemState)
itemState += "[ratio]" ///Used by update_icon_state() and update_overlays()
item_state = itemState /obj/item/gun/energy/proc/get_charge_ratio()
if(ismob(loc)) //forces inhands to update return can_shoot() ? CEILING(clamp(cell.charge / cell.maxcharge, 0, 1) * charge_sections, 1) : 0
var/mob/M = loc // Sets the ratio to 0 if the gun doesn't have enough charge to fire, or if its power cell is removed.
M.update_inv_hands()
/obj/item/gun/energy/suicide_act(mob/living/user) /obj/item/gun/energy/suicide_act(mob/living/user)
if (istype(user) && can_shoot() && can_trigger_gun(user) && user.get_bodypart(BODY_ZONE_HEAD)) if (istype(user) && can_shoot() && can_trigger_gun(user) && user.get_bodypart(BODY_ZONE_HEAD))

View File

@@ -207,12 +207,11 @@
to_chat(user,"<span class='notice'>You switch [src] setting to [setting] mode.</span>") to_chat(user,"<span class='notice'>You switch [src] setting to [setting] mode.</span>")
update_icon() update_icon()
/obj/item/gun/energy/dueling/update_icon(force_update) /obj/item/gun/energy/dueling/update_overlays(force_update)
. = ..() . = ..()
if(setting_overlay) if(setting_overlay)
cut_overlay(setting_overlay)
setting_overlay.icon_state = setting_iconstate() setting_overlay.icon_state = setting_iconstate()
add_overlay(setting_overlay) . += setting_overlay
/obj/item/gun/energy/dueling/Destroy() /obj/item/gun/energy/dueling/Destroy()
if(duel) if(duel)
@@ -363,8 +362,7 @@
STR.max_items = 2 STR.max_items = 2
STR.can_hold = typecacheof(/obj/item/gun/energy/dueling) STR.can_hold = typecacheof(/obj/item/gun/energy/dueling)
/obj/item/storage/lockbox/dueling/update_icon() /obj/item/storage/lockbox/dueling/update_icon_state()
cut_overlays()
var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED) var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)
if(locked) if(locked)
icon_state = "medalbox+l" icon_state = "medalbox+l"

View File

@@ -19,17 +19,13 @@
cell_type = /obj/item/stock_parts/cell{charge = 600; maxcharge = 600} cell_type = /obj/item/stock_parts/cell{charge = 600; maxcharge = 600}
ammo_x_offset = 2 ammo_x_offset = 2
charge_sections = 3 charge_sections = 3
gunlight_state = "mini-light"
can_flashlight = 0 // Can't attach or detach the flashlight, and override it's icon update can_flashlight = 0 // Can't attach or detach the flashlight, and override it's icon update
/obj/item/gun/energy/e_gun/mini/Initialize() /obj/item/gun/energy/e_gun/mini/Initialize()
gun_light = new /obj/item/flashlight/seclite(src) gun_light = new /obj/item/flashlight/seclite(src)
return ..() return ..()
/obj/item/gun/energy/e_gun/mini/update_icon()
..()
if(gun_light && gun_light.on)
add_overlay("mini-light")
/obj/item/gun/energy/e_gun/stun /obj/item/gun/energy/e_gun/stun
name = "tactical energy gun" name = "tactical energy gun"
desc = "Military issue energy gun, is able to fire stun rounds." desc = "Military issue energy gun, is able to fire stun rounds."
@@ -138,15 +134,15 @@
return return
fail_chance = min(fail_chance + round(15/severity), 100) fail_chance = min(fail_chance + round(15/severity), 100)
/obj/item/gun/energy/e_gun/nuclear/update_icon() /obj/item/gun/energy/e_gun/nuclear/update_overlays()
..() . = ..()
if(crit_fail) if(crit_fail)
add_overlay("[icon_state]_fail_3") . += "[icon_state]_fail_3"
else else
switch(fail_tick) switch(fail_tick)
if(0) if(0)
add_overlay("[icon_state]_fail_0") . += "[icon_state]_fail_0"
if(1 to 150) if(1 to 150)
add_overlay("[icon_state]_fail_1") . += "[icon_state]_fail_1"
if(151 to INFINITY) if(151 to INFINITY)
add_overlay("[icon_state]_fail_2") . += "[icon_state]_fail_2"

View File

@@ -46,13 +46,6 @@
range = 4 range = 4
log_override = TRUE log_override = TRUE
/obj/item/gun/energy/kinetic_accelerator/premiumka/update_icon()
..()
if(!can_shoot())
add_overlay("[icon_state]_empty")
else
cut_overlays()
/obj/item/gun/energy/kinetic_accelerator/getinaccuracy(mob/living/user, bonus_spread, stamloss) /obj/item/gun/energy/kinetic_accelerator/getinaccuracy(mob/living/user, bonus_spread, stamloss)
var/old_fire_delay = fire_delay //It's pretty irrelevant tbh but whatever. var/old_fire_delay = fire_delay //It's pretty irrelevant tbh but whatever.
fire_delay = overheat_time fire_delay = overheat_time
@@ -187,11 +180,9 @@
overheat = FALSE overheat = FALSE
/obj/item/gun/energy/kinetic_accelerator/update_icon() /obj/item/gun/energy/kinetic_accelerator/update_icon()
..() . += ..()
if(!can_shoot()) if(!can_shoot())
add_overlay("[icon_state]_empty") . += "[icon_state]_empty"
else
cut_overlays()
//Casing //Casing
/obj/item/ammo_casing/energy/kinetic /obj/item/ammo_casing/energy/kinetic

View File

@@ -34,11 +34,11 @@
pin = null pin = null
ammo_x_offset = 1 ammo_x_offset = 1
/obj/item/gun/energy/decloner/update_icon() /obj/item/gun/energy/decloner/update_overlays()
..() ..()
var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index] var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index]
if(!QDELETED(cell) && (cell.charge > shot.e_cost)) if(!QDELETED(cell) && (cell.charge > shot.e_cost))
add_overlay("decloner_spin") . += "decloner_spin"
/obj/item/gun/energy/floragun /obj/item/gun/energy/floragun
name = "floral somatoray" name = "floral somatoray"
@@ -134,9 +134,10 @@
tool_behaviour = TOOL_WELDER tool_behaviour = TOOL_WELDER
toolspeed = 0.7 //plasmacutters can be used as welders, and are faster than standard welders toolspeed = 0.7 //plasmacutters can be used as welders, and are faster than standard welders
/obj/item/gun/energy/plasmacutter/Initialize() /obj/item/gun/energy/plasmacutter/ComponentInitialize()
. = ..() . = ..()
AddComponent(/datum/component/butchering, 25, 105, 0, 'sound/weapons/plasma_cutter.ogg') AddComponent(/datum/component/butchering, 25, 105, 0, 'sound/weapons/plasma_cutter.ogg')
AddElement(/datum/element/update_icon_blocker)
/obj/item/gun/energy/plasmacutter/examine(mob/user) /obj/item/gun/energy/plasmacutter/examine(mob/user)
. = ..() . = ..()
@@ -166,9 +167,6 @@
/obj/item/gun/energy/plasmacutter/use(amount) /obj/item/gun/energy/plasmacutter/use(amount)
return cell.use(amount * 100) return cell.use(amount * 100)
/obj/item/gun/energy/plasmacutter/update_icon()
return
/obj/item/gun/energy/plasmacutter/adv /obj/item/gun/energy/plasmacutter/adv
name = "advanced plasma cutter" name = "advanced plasma cutter"
icon_state = "adv_plasmacutter" icon_state = "adv_plasmacutter"
@@ -183,11 +181,12 @@
icon_state = "wormhole_projector" icon_state = "wormhole_projector"
pin = null pin = null
inaccuracy_modifier = 0.25 inaccuracy_modifier = 0.25
automatic_charge_overlays = FALSE
var/obj/effect/portal/p_blue var/obj/effect/portal/p_blue
var/obj/effect/portal/p_orange var/obj/effect/portal/p_orange
var/atmos_link = FALSE var/atmos_link = FALSE
/obj/item/gun/energy/wormhole_projector/update_icon() /obj/item/gun/energy/wormhole_projector/update_icon_state()
icon_state = "[initial(icon_state)][current_firemode_index]" icon_state = "[initial(icon_state)][current_firemode_index]"
item_state = icon_state item_state = icon_state
@@ -256,8 +255,9 @@
can_charge = 0 can_charge = 0
use_cyborg_cell = 1 use_cyborg_cell = 1
/obj/item/gun/energy/printer/update_icon() /obj/item/gun/energy/printer/ComponentInitialize()
return . = ..()
AddElement(/datum/element/update_icon_blocker)
/obj/item/gun/energy/printer/emp_act() /obj/item/gun/energy/printer/emp_act()
return return
@@ -321,14 +321,14 @@
inaccuracy_modifier = 0.25 inaccuracy_modifier = 0.25
cell_type = /obj/item/stock_parts/cell/super cell_type = /obj/item/stock_parts/cell/super
ammo_type = list(/obj/item/ammo_casing/energy/emitter) ammo_type = list(/obj/item/ammo_casing/energy/emitter)
automatic_charge_overlays = FALSE
/obj/item/gun/energy/emitter/update_icon() /obj/item/gun/energy/emitter/update_icon_state()
..()
var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index] var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index]
if(!QDELETED(cell) && (cell.charge > shot.e_cost)) if(!QDELETED(cell) && (cell.charge > shot.e_cost))
add_overlay("emitter_carbine_empty") icon_state = "emitter_carbine_empty"
else else
add_overlay("emitter_carbine") icon_state = "emitter_carbine"
//the pickle ray //the pickle ray
/obj/item/gun/energy/pickle_gun /obj/item/gun/energy/pickle_gun

View File

@@ -35,6 +35,7 @@
slowdown = 1 slowdown = 1
item_flags = NO_MAT_REDEMPTION | SLOWS_WHILE_IN_HAND | NEEDS_PERMIT item_flags = NO_MAT_REDEMPTION | SLOWS_WHILE_IN_HAND | NEEDS_PERMIT
pin = null pin = null
automatic_charge_overlays = FALSE
var/aiming = FALSE var/aiming = FALSE
var/aiming_time = 14 var/aiming_time = 14
var/aiming_time_fire_threshold = 5 var/aiming_time_fire_threshold = 5
@@ -152,13 +153,13 @@
current_zoom_x = 0 current_zoom_x = 0
current_zoom_y = 0 current_zoom_y = 0
/obj/item/gun/energy/beam_rifle/update_icon() /obj/item/gun/energy/beam_rifle/update_overlays()
cut_overlays() . = ..()
var/obj/item/ammo_casing/energy/primary_ammo = ammo_type[1] var/obj/item/ammo_casing/energy/primary_ammo = ammo_type[1]
if(!QDELETED(cell) && (cell.charge > primary_ammo.e_cost)) if(!QDELETED(cell) && (cell.charge > primary_ammo.e_cost))
add_overlay(charged_overlay) . += charged_overlay
else else
add_overlay(drained_overlay) . += drained_overlay
/obj/item/gun/energy/beam_rifle/attack_self(mob/user) /obj/item/gun/energy/beam_rifle/attack_self(mob/user)
if(!structure_piercing) if(!structure_piercing)

View File

@@ -41,18 +41,16 @@
user.put_in_hands(bomb) user.put_in_hands(bomb)
user.visible_message("<span class='warning'>[user] detaches [bomb] from [src].</span>") user.visible_message("<span class='warning'>[user] detaches [bomb] from [src].</span>")
bomb = null bomb = null
name = initial(name)
desc = initial(desc)
update_icon() update_icon()
return ..() return ..()
/obj/item/gun/blastcannon/update_icon() /obj/item/gun/blastcannon/update_icon_state()
if(bomb) if(bomb)
icon_state = icon_state_loaded icon_state = icon_state_loaded
name = "blast cannon"
desc = "A makeshift device used to concentrate a bomb's blast energy to a narrow wave."
else else
icon_state = initial(icon_state) icon_state = initial(icon_state)
name = initial(name)
desc = initial(desc)
/obj/item/gun/blastcannon/attackby(obj/O, mob/user) /obj/item/gun/blastcannon/attackby(obj/O, mob/user)
if(istype(O, /obj/item/transfer_valve)) if(istype(O, /obj/item/transfer_valve))
@@ -65,6 +63,8 @@
return FALSE return FALSE
user.visible_message("<span class='warning'>[user] attaches [T] to [src]!</span>") user.visible_message("<span class='warning'>[user] attaches [T] to [src]!</span>")
bomb = T bomb = T
name = "blast cannon"
desc = "A makeshift device used to concentrate a bomb's blast energy to a narrow wave."
update_icon() update_icon()
return TRUE return TRUE
return ..() return ..()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -16,13 +16,12 @@
spread = 20 spread = 20
actions_types = list() actions_types = list()
/obj/item/gun/ballistic/automatic/toy/pistol/stealth/update_icon() /obj/item/gun/ballistic/automatic/toy/pistol/stealth/update_overlays()
..() . = ..()
if(magazine) if(magazine)
cut_overlays() . += "foamsp-magazine"
add_overlay("foamsp-magazine")
else /obj/item/gun/ballistic/automatic/toy/pistol/stealth/update_icon_state()
cut_overlays()
icon_state = "[initial(icon_state)][chambered ? "" : "-e"]" icon_state = "[initial(icon_state)][chambered ? "" : "-e"]"
/////////RAYGUN MEMES///////// /////////RAYGUN MEMES/////////

View File

@@ -155,11 +155,15 @@
casing_ejector = 0 casing_ejector = 0
spread = 10 spread = 10
recoil = 0.05 recoil = 0.05
automatic_burst_overlay = FALSE
var/magtype = "flechettegun"
/obj/item/gun/ballistic/automatic/flechette/update_icon() /obj/item/gun/ballistic/automatic/flechette/update_overlays()
cut_overlays() . = ..()
if(magazine) if(magazine)
add_overlay("flechettegun-magazine") . += "[magtype]-magazine"
/obj/item/gun/ballistic/automatic/flechette/update_icon_state()
icon_state = "[initial(icon_state)][chambered ? "" : "-e"]" icon_state = "[initial(icon_state)][chambered ? "" : "-e"]"
///unique variant/// ///unique variant///
@@ -185,12 +189,7 @@
w_class = WEIGHT_CLASS_SMALL w_class = WEIGHT_CLASS_SMALL
spread = 15 spread = 15
recoil = 0.1 recoil = 0.1
magtype = "shreddergun"
/obj/item/gun/ballistic/automatic/flechette/shredder/update_icon()
cut_overlays()
if(magazine)
add_overlay("shreddergun-magazine")
icon_state = "[initial(icon_state)][chambered ? "" : "-e"]"
/*///////////////////////////////////////////////////////////// /*/////////////////////////////////////////////////////////////
//////////////////////// Zero's Meme ////////////////////////// //////////////////////// Zero's Meme //////////////////////////
@@ -218,17 +217,19 @@
burst_size = 4 //Shh. burst_size = 4 //Shh.
fire_delay = 1 fire_delay = 1
var/body_color = "#3333aa" var/body_color = "#3333aa"
automatic_burst_overlay = FALSE
/obj/item/gun/ballistic/automatic/AM4B/update_icon() /obj/item/gun/ballistic/automatic/AM4B/ComponentInitialize()
..() . = ..()
AddElement(/datum/element/update_icon_updates_onmob)
/obj/item/gun/ballistic/automatic/AM4B/update_overlays()
. = ..()
var/mutable_appearance/body_overlay = mutable_appearance('modular_citadel/icons/obj/guns/cit_guns.dmi', "AM4-Body") var/mutable_appearance/body_overlay = mutable_appearance('modular_citadel/icons/obj/guns/cit_guns.dmi', "AM4-Body")
if(body_color) if(body_color)
body_overlay.color = body_color body_overlay.color = body_color
cut_overlays() //So that it doesn't keep stacking overlays non-stop on top of each other . += body_overlay
add_overlay(body_overlay)
if(ismob(loc))
var/mob/M = loc
M.update_inv_hands()
/obj/item/gun/ballistic/automatic/AM4B/AltClick(mob/living/user) /obj/item/gun/ballistic/automatic/AM4B/AltClick(mob/living/user)
. = ..() . = ..()
if(!in_range(src, user)) //Basic checks to prevent abuse if(!in_range(src, user)) //Basic checks to prevent abuse

View File

@@ -55,8 +55,7 @@
/obj/item/gun/ballistic/automatic/spinfusor/attack_self(mob/living/user) /obj/item/gun/ballistic/automatic/spinfusor/attack_self(mob/living/user)
return //caseless rounds are too glitchy to unload properly. Best to make it so that you cannot remove disks from the spinfusor return //caseless rounds are too glitchy to unload properly. Best to make it so that you cannot remove disks from the spinfusor
/obj/item/gun/ballistic/automatic/spinfusor/update_icon() /obj/item/gun/ballistic/automatic/spinfusor/update_icon_state()
..()
icon_state = "spinfusor[magazine ? "-[get_ammo(1)]" : ""]" icon_state = "spinfusor[magazine ? "-[get_ammo(1)]" : ""]"
/obj/item/ammo_box/aspinfusor /obj/item/ammo_box/aspinfusor

View File

@@ -14,16 +14,16 @@ obj/item/gun/energy/e_gun/cx
flight_y_offset = 10 flight_y_offset = 10
var/body_color = "#252528" var/body_color = "#252528"
obj/item/gun/energy/e_gun/cx/update_icon() obj/item/gun/energy/e_gun/cx/ComponentInitialize()
..() . = ..()
AddElement(/datum/element/update_icon_updates_onmob)
obj/item/gun/energy/e_gun/cx/update_overlays()
. = ..()
var/mutable_appearance/body_overlay = mutable_appearance('modular_citadel/icons/obj/guns/cit_guns.dmi', "cxegun_body") var/mutable_appearance/body_overlay = mutable_appearance('modular_citadel/icons/obj/guns/cit_guns.dmi', "cxegun_body")
if(body_color) if(body_color)
body_overlay.color = body_color body_overlay.color = body_color
add_overlay(body_overlay) . += body_overlay
if(ismob(loc))
var/mob/M = loc
M.update_inv_hands()
obj/item/gun/energy/e_gun/cx/AltClick(mob/living/user) obj/item/gun/energy/e_gun/cx/AltClick(mob/living/user)
. = ..() . = ..()

View File

@@ -52,13 +52,13 @@
if(has_shot) if(has_shot)
recharge_newshot(TRUE) recharge_newshot(TRUE)
/obj/item/gun/energy/pumpaction/update_icon() //adds racked indicators /obj/item/gun/energy/pumpaction/update_overlays() //adds racked indicators
..() ..()
var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index] var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index]
if(chambered) if(chambered)
add_overlay("[icon_state]_rack_[shot.select_name]") . += "[icon_state]_rack_[shot.select_name]"
else else
add_overlay("[icon_state]_rack_empty") . += "[icon_state]_rack_empty"
/obj/item/gun/energy/pumpaction/proc/pump(mob/M) //pumping proc. Checks if the gun is empty and plays a different sound if it is. /obj/item/gun/energy/pumpaction/proc/pump(mob/M) //pumping proc. Checks if the gun is empty and plays a different sound if it is.
var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index] var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index]