mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 01:49:19 +00:00
Removing priority overlays, update_icon() splitup for guns.
This commit is contained in:
@@ -150,7 +150,6 @@
|
||||
if (TRUE) {\
|
||||
var/list/ad = A.add_overlays;\
|
||||
var/list/rm = A.remove_overlays;\
|
||||
var/list/po = A.priority_overlays;\
|
||||
if(LAZYLEN(rm)){\
|
||||
A.overlays -= rm;\
|
||||
A.remove_overlays = null;\
|
||||
@@ -159,11 +158,5 @@
|
||||
A.overlays |= ad;\
|
||||
A.add_overlays = null;\
|
||||
}\
|
||||
if(LAZYLEN(po)){\
|
||||
A.overlays |= po;\
|
||||
}\
|
||||
else{\
|
||||
A.priority_overlays = null;\
|
||||
}\
|
||||
A.flags_1 &= ~OVERLAY_QUEUED_1;\
|
||||
}
|
||||
|
||||
@@ -122,13 +122,13 @@
|
||||
if(pixel_size == pixels)
|
||||
return
|
||||
pixel_size = pixels
|
||||
cut_overlays(TRUE)
|
||||
cut_overlays()
|
||||
//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)
|
||||
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
|
||||
add_overlay(left, TRUE)
|
||||
add_overlay(right, TRUE)
|
||||
add_overlay(left)
|
||||
add_overlay(right)
|
||||
|
||||
/obj/screen/storage/volumetric_edge
|
||||
layer = VOLUMETRIC_STORAGE_BOX_LAYER
|
||||
|
||||
@@ -29,7 +29,7 @@ SUBSYSTEM_DEF(acid)
|
||||
|
||||
if(O.acid_level && O.acid_processing())
|
||||
else
|
||||
O.cut_overlay(GLOB.acid_overlay, TRUE)
|
||||
O.update_icon()
|
||||
processing -= O
|
||||
|
||||
if (MC_TICK_CHECK)
|
||||
|
||||
@@ -114,67 +114,47 @@ SUBSYSTEM_DEF(overlays)
|
||||
|
||||
#define NOT_QUEUED_ALREADY (!(flags_1 & OVERLAY_QUEUED_1))
|
||||
#define QUEUE_FOR_COMPILE flags_1 |= OVERLAY_QUEUED_1; SSoverlays.queue += src;
|
||||
/atom/proc/cut_overlays(priority = FALSE)
|
||||
LAZYINITLIST(priority_overlays)
|
||||
/atom/proc/cut_overlays()
|
||||
LAZYINITLIST(remove_overlays)
|
||||
LAZYINITLIST(add_overlays)
|
||||
remove_overlays = overlays.Copy()
|
||||
add_overlays.Cut()
|
||||
|
||||
if(priority)
|
||||
priority_overlays.Cut()
|
||||
|
||||
//If not already queued for work and there are overlays to remove
|
||||
if(NOT_QUEUED_ALREADY && remove_overlays.len)
|
||||
QUEUE_FOR_COMPILE
|
||||
|
||||
/atom/proc/cut_overlay(list/overlays, priority)
|
||||
/atom/proc/cut_overlay(list/overlays)
|
||||
if(!overlays)
|
||||
return
|
||||
overlays = build_appearance_list(overlays)
|
||||
LAZYINITLIST(add_overlays) //always initialized after this point
|
||||
LAZYINITLIST(priority_overlays)
|
||||
LAZYINITLIST(remove_overlays)
|
||||
var/a_len = add_overlays.len
|
||||
var/r_len = remove_overlays.len
|
||||
var/p_len = priority_overlays.len
|
||||
remove_overlays += overlays
|
||||
add_overlays -= overlays
|
||||
|
||||
|
||||
if(priority)
|
||||
var/list/cached_priority = priority_overlays
|
||||
LAZYREMOVE(cached_priority, overlays)
|
||||
|
||||
var/fa_len = add_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_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
|
||||
|
||||
/atom/proc/add_overlay(list/overlays, priority = FALSE)
|
||||
/atom/proc/add_overlay(list/overlays)
|
||||
if(!overlays)
|
||||
return
|
||||
|
||||
overlays = build_appearance_list(overlays)
|
||||
|
||||
LAZYINITLIST(add_overlays) //always initialized after this point
|
||||
LAZYINITLIST(priority_overlays)
|
||||
var/a_len = add_overlays.len
|
||||
var/p_len = priority_overlays.len
|
||||
|
||||
if(priority)
|
||||
priority_overlays += overlays //or in the image. Can we use [image] = image?
|
||||
var/fp_len = priority_overlays.len
|
||||
if(NOT_QUEUED_ALREADY && fp_len != p_len)
|
||||
QUEUE_FOR_COMPILE
|
||||
else
|
||||
add_overlays += overlays
|
||||
var/fa_len = add_overlays.len
|
||||
if(NOT_QUEUED_ALREADY && fa_len != a_len)
|
||||
QUEUE_FOR_COMPILE
|
||||
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
|
||||
if(!other)
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
|
||||
/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))
|
||||
current_button.cut_overlays(TRUE)
|
||||
current_button.cut_overlays()
|
||||
current_button.add_overlay(mutable_appearance(icon_icon, button_icon_state))
|
||||
current_button.button_icon_state = button_icon_state
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
UnregisterSignal(weapon, list(COMSIG_MOVABLE_MOVED, COMSIG_PARENT_QDELETING))
|
||||
if(overlay)
|
||||
var/atom/A = parent
|
||||
A.cut_overlay(overlay, TRUE)
|
||||
UnregisterSignal(A,COMSIG_ATOM_UPDATE_OVERLAYS)
|
||||
qdel(overlay)
|
||||
|
||||
return ..()
|
||||
@@ -326,7 +326,8 @@
|
||||
var/matrix/M = matrix()
|
||||
M.Translate(pixelX, pixelY)
|
||||
overlay.transform = M
|
||||
hit.add_overlay(overlay, TRUE)
|
||||
RegisterSignal(hit,COMSIG_ATOM_UPDATE_OVERLAYS,.proc/apply_overlay)
|
||||
hit.update_icon()
|
||||
|
||||
if(harmful)
|
||||
hit.visible_message("<span class='danger'>[weapon] embeds itself in [hit]!</span>")
|
||||
@@ -339,6 +340,8 @@
|
||||
else
|
||||
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)
|
||||
if(harmful)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
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/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, \
|
||||
sound = 'sound/magic/charge.ogg', end_sound = 'sound/machines/ding.ogg', diss = FALSE, del_overload = FALSE)
|
||||
@@ -47,9 +48,8 @@
|
||||
holder = L
|
||||
var/to_add = charges >= 1 ? shield_state : broken_state
|
||||
if(to_add)
|
||||
var/mutable_appearance/M = mutable_appearance('icons/effects/effects.dmi', to_add)
|
||||
M.layer = (L.layer > MOB_LAYER ? L.layer : MOB_LAYER) + 0.01
|
||||
holder.add_overlay(M, TRUE)
|
||||
var/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)
|
||||
|
||||
/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))
|
||||
if(holder)
|
||||
UnregisterSignal(holder, list(COMSIG_LIVING_RUN_BLOCK, COMSIG_LIVING_GET_BLOCKING_ITEMS))
|
||||
var/to_remove = charges >= 1 ? shield_state : broken_state
|
||||
if(to_remove)
|
||||
holder.cut_overlay(mutable_appearance('icons/effects/effects.dmi', to_remove), TRUE)
|
||||
if(cached_vis_overlay)
|
||||
SSvis_overlays.remove_vis_overlay(holder, cached_vis_overlay)
|
||||
cached_vis_overlay = null
|
||||
holder = null
|
||||
|
||||
/datum/component/shielded/process()
|
||||
@@ -80,7 +80,7 @@
|
||||
holder.visible_message("[holder]'s shield overloads!")
|
||||
qdel(src)
|
||||
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)
|
||||
|
||||
/datum/component/shielded/proc/adjust_charges(amount)
|
||||
@@ -93,20 +93,19 @@
|
||||
holder.visible_message("[holder]'s shield overloads!")
|
||||
qdel(src)
|
||||
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)
|
||||
|
||||
/datum/component/shielded/proc/update_shield_overlay(broken)
|
||||
if(!holder)
|
||||
return
|
||||
var/to_remove = broken ? shield_state : broken_state
|
||||
var/to_add = broken ? broken_state : shield_state
|
||||
if(to_remove)
|
||||
holder.cut_overlay(mutable_appearance('icons/effects/effects.dmi', to_remove), TRUE)
|
||||
if(cached_vis_overlay)
|
||||
SSvis_overlays.remove_vis_overlay(holder, cached_vis_overlay)
|
||||
cached_vis_overlay = null
|
||||
if(to_add)
|
||||
var/mutable_appearance/M = mutable_appearance('icons/effects/effects.dmi', to_add)
|
||||
M.layer = (holder.layer > MOB_LAYER ? holder.layer : MOB_LAYER) + 0.01
|
||||
holder.add_overlay(M, TRUE)
|
||||
var/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)
|
||||
|
||||
/datum/component/shielded/proc/on_equip(obj/item/source, mob/living/equipper, slot)
|
||||
if(!(accepted_slots & slotdefine2slotbit(slot)))
|
||||
@@ -117,17 +116,16 @@
|
||||
RegisterSignal(equipper, COMSIG_LIVING_GET_BLOCKING_ITEMS, .proc/include_shield)
|
||||
var/to_add = charges >= 1 ? shield_state : broken_state
|
||||
if(to_add)
|
||||
var/mutable_appearance/M = mutable_appearance('icons/effects/effects.dmi', to_add)
|
||||
M.layer = (holder.layer > MOB_LAYER ? holder.layer : MOB_LAYER) + 0.01
|
||||
equipper.add_overlay(M, TRUE)
|
||||
var/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)
|
||||
|
||||
/datum/component/shielded/proc/on_drop(obj/item/source, mob/dropper)
|
||||
if(holder == dropper)
|
||||
UnregisterSignal(holder, COMSIG_LIVING_GET_BLOCKING_ITEMS)
|
||||
UnregisterSignal(parent, list(COMSIG_ITEM_RUN_BLOCK, COMSIG_ITEM_CHECK_BLOCK))
|
||||
var/to_remove = charges >= 1 ? shield_state : broken_state
|
||||
if(to_remove)
|
||||
holder.cut_overlay(mutable_appearance('icons/effects/effects.dmi', to_remove), TRUE)
|
||||
if(cached_vis_overlay)
|
||||
SSvis_overlays.remove_vis_overlay(holder, cached_vis_overlay)
|
||||
cached_vis_overlay = null
|
||||
holder = null
|
||||
|
||||
/datum/component/shielded/proc/include_shield(mob/source, list/items)
|
||||
|
||||
@@ -33,39 +33,34 @@
|
||||
if(description)
|
||||
RegisterSignal(A, COMSIG_PARENT_EXAMINE, .proc/examine)
|
||||
|
||||
apply(A, TRUE)
|
||||
|
||||
num_decals_per_atom[A]++
|
||||
apply(A)
|
||||
|
||||
/datum/element/decal/Detach(datum/target)
|
||||
var/atom/A = target
|
||||
remove(A, A.dir)
|
||||
UnregisterSignal(A, list(COMSIG_ATOM_DIR_CHANGE, COMSIG_COMPONENT_CLEAN_ACT, COMSIG_PARENT_EXAMINE))
|
||||
LAZYREMOVE(num_decals_per_atom, A)
|
||||
num_decals_per_atom[A]--
|
||||
apply(A, TRUE)
|
||||
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 ..()
|
||||
|
||||
/datum/element/decal/proc/remove(atom/target, old_dir)
|
||||
pic.dir = first_dir == NORTH ? target.dir : turn(first_dir, dir2angle(old_dir))
|
||||
for(var/i in 1 to num_decals_per_atom[target])
|
||||
target.cut_overlay(pic, TRUE)
|
||||
/datum/element/decal/proc/apply(atom/target, removing = FALSE)
|
||||
if(num_decals_per_atom[target] == 1 && !removing)
|
||||
RegisterSignal(target, COMSIG_ATOM_UPDATE_OVERLAYS, .proc/apply_overlay, TRUE)
|
||||
target.update_icon()
|
||||
if(isitem(target))
|
||||
addtimer(CALLBACK(target, /obj/item/.proc/update_slot_icon), 0, TIMER_UNIQUE)
|
||||
|
||||
/datum/element/decal/proc/apply(atom/target, init = FALSE)
|
||||
pic.dir = first_dir == NORTH ? target.dir : turn(first_dir, dir2angle(target.dir))
|
||||
if(init)
|
||||
target.add_overlay(pic, TRUE)
|
||||
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/apply_overlay(atom/source, list/overlay_list)
|
||||
pic.dir = first_dir == NORTH ? source.dir : turn(first_dir, dir2angle(source.dir))
|
||||
for(var/i in 1 to num_decals_per_atom[source])
|
||||
overlay_list += pic
|
||||
|
||||
/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)
|
||||
return
|
||||
remove(source, old_dir)
|
||||
apply(source)
|
||||
source.update_icon()
|
||||
|
||||
/datum/element/decal/proc/clean_react(datum/source, strength)
|
||||
if(strength >= cleanable)
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
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...
|
||||
|
||||
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/add_overlays // a very temporary list of overlays to add
|
||||
|
||||
@@ -145,7 +144,6 @@
|
||||
qdel(reagents)
|
||||
|
||||
LAZYCLEARLIST(overlays)
|
||||
LAZYCLEARLIST(priority_overlays)
|
||||
|
||||
for(var/i in targeted_by)
|
||||
var/mob/M = i
|
||||
@@ -1128,4 +1126,4 @@
|
||||
* Override this if you want custom behaviour in whatever gets hit by the rust
|
||||
*/
|
||||
/atom/proc/rust_heretic_act()
|
||||
return
|
||||
return
|
||||
|
||||
@@ -60,7 +60,8 @@
|
||||
if(target)
|
||||
if(!QDELETED(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)
|
||||
target.ex_act(EXPLODE_HEAVY, target)
|
||||
else
|
||||
@@ -126,13 +127,17 @@
|
||||
I.embedding["embed_chance"] = 0
|
||||
I.updateEmbedding()
|
||||
|
||||
target.add_overlay(plastic_overlay, TRUE)
|
||||
RegisterSignal(target, COMSIG_ATOM_UPDATE_OVERLAYS, .proc/add_plastic_overlay)
|
||||
target.update_icon()
|
||||
if(!nadeassembly)
|
||||
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)
|
||||
else
|
||||
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)
|
||||
if(!M)
|
||||
return
|
||||
|
||||
@@ -186,7 +186,7 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e
|
||||
|
||||
if(!acid_level)
|
||||
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.
|
||||
if(acid_level < 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))
|
||||
resistance_flags |= ON_FIRE
|
||||
SSfire_burning.processing[src] = src
|
||||
add_overlay(GLOB.fire_overlay, TRUE)
|
||||
update_icon()
|
||||
return 1
|
||||
|
||||
//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()
|
||||
if(resistance_flags & ON_FIRE)
|
||||
resistance_flags &= ~ON_FIRE
|
||||
cut_overlay(GLOB.fire_overlay, TRUE)
|
||||
update_icon()
|
||||
SSfire_burning.processing -= src
|
||||
|
||||
/obj/zap_act(power, zap_flags, shocked_targets)
|
||||
|
||||
@@ -317,6 +317,13 @@
|
||||
icon_state = unique_reskin[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
|
||||
//Has a reference to the autolathe so you can do !!FUN!! things with hacked lathes
|
||||
/obj/proc/autolathe_crafted(obj/machinery/autolathe/A)
|
||||
|
||||
@@ -118,8 +118,7 @@
|
||||
|
||||
// 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)
|
||||
damaged_clothes = CLOTHING_PRISTINE
|
||||
update_clothes_damaged_state(FALSE)
|
||||
update_clothes_damaged_state(CLOTHING_PRISTINE)
|
||||
obj_integrity = max_integrity
|
||||
name = initial(name) // remove "tattered" or "shredded" if there's a prefix
|
||||
body_parts_covered = initial(body_parts_covered)
|
||||
@@ -196,7 +195,7 @@
|
||||
if(3 to INFINITY) // take better care of your shit, dude
|
||||
name = "tattered [initial(name)]"
|
||||
|
||||
update_clothes_damaged_state()
|
||||
update_clothes_damaged_state(CLOTHING_DAMAGED)
|
||||
|
||||
/obj/item/clothing/Destroy()
|
||||
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 += "</span>"
|
||||
. += how_cool_are_your_threads.Join()
|
||||
|
||||
|
||||
if(LAZYLEN(armor_list))
|
||||
armor_list.Cut()
|
||||
if(armor.bio)
|
||||
@@ -346,10 +345,16 @@
|
||||
var/mob/M = loc
|
||||
to_chat(M, "<span class='warning'>Your [name] starts to fall apart!</span>")
|
||||
|
||||
/obj/item/clothing/proc/update_clothes_damaged_state(damaging = TRUE)
|
||||
var/index = "[REF(initial(icon))]-[initial(icon_state)]"
|
||||
var/static/list/damaged_clothes_icons = list()
|
||||
if(damaging)
|
||||
//This mostly exists so subtypes can call appriopriate update icon calls on the wearer.
|
||||
/obj/item/clothing/proc/update_clothes_damaged_state(damaged_state = CLOTHING_DAMAGED)
|
||||
damaged_clothes = damaged_state
|
||||
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]
|
||||
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
|
||||
@@ -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 = fcopy_rsc(damaged_clothes_icon)
|
||||
damaged_clothes_icons[index] = damaged_clothes_icon
|
||||
add_overlay(damaged_clothes_icon, TRUE)
|
||||
else
|
||||
cut_overlay(damaged_clothes_icons[index], TRUE)
|
||||
. += damaged_clothes_icon
|
||||
|
||||
/*
|
||||
SEE_SELF // can see self, no matter what
|
||||
|
||||
@@ -21,7 +21,7 @@ INITIALIZE_IMMEDIATE(/mob/living/carbon/human/dummy)
|
||||
/mob/living/carbon/human/dummy/proc/wipe_state()
|
||||
delete_equipment()
|
||||
icon_render_key = null
|
||||
cut_overlays(TRUE)
|
||||
cut_overlays()
|
||||
|
||||
//Inefficient pooling/caching way.
|
||||
GLOBAL_LIST_EMPTY(human_dummy_list)
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
eyes_overlay.pixel_y = -8
|
||||
moustache_overlay.pixel_y = -8
|
||||
|
||||
cut_overlays(TRUE)
|
||||
cut_overlays()
|
||||
add_overlay(body_overlay)
|
||||
add_overlay(eyes_overlay)
|
||||
add_overlay(moustache_overlay)
|
||||
|
||||
@@ -62,7 +62,8 @@
|
||||
var/no_pin_required = FALSE //whether the gun can be fired without a pin
|
||||
|
||||
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/mutable_appearance/knife_overlay
|
||||
var/can_bayonet = FALSE
|
||||
@@ -417,14 +418,7 @@
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You attach \the [K] to the front of \the [src].</span>")
|
||||
bayonet = K
|
||||
var/state = "bayonet" //Generic state.
|
||||
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)
|
||||
update_icon()
|
||||
else if(istype(I, /obj/item/screwdriver))
|
||||
if(gun_light)
|
||||
var/obj/item/flashlight/seclite/S = gun_light
|
||||
@@ -439,8 +433,7 @@
|
||||
var/obj/item/kitchen/knife/K = bayonet
|
||||
K.forceMove(get_turf(user))
|
||||
bayonet = null
|
||||
cut_overlay(knife_overlay, TRUE)
|
||||
knife_overlay = null
|
||||
update_icon()
|
||||
else
|
||||
return ..()
|
||||
|
||||
@@ -468,22 +461,35 @@
|
||||
set_light(gun_light.brightness_on, gun_light.flashlight_power, gun_light.light_color)
|
||||
else
|
||||
set_light(0)
|
||||
cut_overlays(flashlight_overlay, TRUE)
|
||||
var/state = "flight[gun_light.on? "_on":""]" //Generic state.
|
||||
else
|
||||
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?
|
||||
state = gun_light.icon_state
|
||||
flashlight_overlay = mutable_appearance('icons/obj/guns/flashlights.dmi', state)
|
||||
flashlight_overlay.pixel_x = flight_x_offset
|
||||
flashlight_overlay.pixel_y = flight_y_offset
|
||||
add_overlay(flashlight_overlay, TRUE)
|
||||
else
|
||||
set_light(0)
|
||||
cut_overlays(flashlight_overlay, TRUE)
|
||||
flashlight_overlay = null
|
||||
update_icon(TRUE)
|
||||
for(var/X in actions)
|
||||
var/datum/action/A = X
|
||||
A.UpdateButtonIcon()
|
||||
. += flashlight_overlay
|
||||
|
||||
if(bayonet)
|
||||
var/mutable_appearance/knife_overlay
|
||||
var/state = "bayonet" //Generic state.
|
||||
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
|
||||
. += knife_overlay
|
||||
|
||||
/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)
|
||||
|
||||
@@ -18,13 +18,15 @@
|
||||
/obj/item/gun/ballistic/automatic/proto/unrestricted
|
||||
pin = /obj/item/firing_pin
|
||||
|
||||
/obj/item/gun/ballistic/automatic/update_icon()
|
||||
..()
|
||||
/obj/item/gun/ballistic/automatic/update_overlays()
|
||||
. = ..()
|
||||
if(automatic_burst_overlay)
|
||||
if(!select)
|
||||
add_overlay("[initial(icon_state)]semi")
|
||||
. += ("[initial(icon_state)]semi")
|
||||
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" : ""]"
|
||||
|
||||
/obj/item/gun/ballistic/automatic/attackby(obj/item/A, mob/user, params)
|
||||
@@ -115,8 +117,7 @@
|
||||
. = ..()
|
||||
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" : ""]"
|
||||
|
||||
/obj/item/gun/ballistic/automatic/wt550
|
||||
@@ -141,9 +142,8 @@
|
||||
. = ..()
|
||||
spread = 0
|
||||
|
||||
/obj/item/gun/ballistic/automatic/wt550/update_icon()
|
||||
..()
|
||||
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/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.
|
||||
|
||||
/obj/item/gun/ballistic/automatic/mini_uzi
|
||||
name = "\improper Type U3 Uzi"
|
||||
@@ -160,6 +160,7 @@
|
||||
mag_type = /obj/item/ammo_box/magazine/m556
|
||||
fire_sound = 'sound/weapons/gunshot_smg.ogg'
|
||||
can_suppress = FALSE
|
||||
automatic_burst_overlay = FALSE
|
||||
var/obj/item/gun/ballistic/revolver/grenadelauncher/underbarrel
|
||||
burst_size = 3
|
||||
burst_shot_delay = 2
|
||||
@@ -191,18 +192,19 @@
|
||||
underbarrel.attackby(A, user, params)
|
||||
else
|
||||
..()
|
||||
/obj/item/gun/ballistic/automatic/m90/update_icon()
|
||||
..()
|
||||
cut_overlays()
|
||||
/obj/item/gun/ballistic/automatic/m90/update_overlays()
|
||||
. = ..()
|
||||
switch(select)
|
||||
if(0)
|
||||
add_overlay("[initial(icon_state)]semi")
|
||||
. += "[initial(icon_state)]semi"
|
||||
if(1)
|
||||
add_overlay("[initial(icon_state)]burst")
|
||||
. += "[initial(icon_state)]burst"
|
||||
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"]"
|
||||
return
|
||||
|
||||
/obj/item/gun/ballistic/automatic/m90/burst_select()
|
||||
var/mob/living/carbon/human/user = usr
|
||||
switch(select)
|
||||
@@ -257,6 +259,7 @@
|
||||
weapon_weight = WEAPON_MEDIUM
|
||||
mag_type = /obj/item/ammo_box/magazine/m12g
|
||||
fire_sound = 'sound/weapons/gunshot.ogg'
|
||||
automatic_burst_overlay = FALSE
|
||||
can_suppress = FALSE
|
||||
burst_size = 1
|
||||
pin = /obj/item/firing_pin/implant/pindicate
|
||||
@@ -269,10 +272,13 @@
|
||||
. = ..()
|
||||
update_icon()
|
||||
|
||||
/obj/item/gun/ballistic/automatic/shotgun/bulldog/update_icon()
|
||||
cut_overlays()
|
||||
/obj/item/gun/ballistic/automatic/shotgun/bulldog/update_icon_state()
|
||||
return
|
||||
|
||||
/obj/item/gun/ballistic/automatic/shotgun/bulldog/update_overlays()
|
||||
. = ..()
|
||||
if(magazine)
|
||||
add_overlay("[magazine.icon_state]")
|
||||
. += "[magazine.icon_state]"
|
||||
icon_state = "bulldog[chambered ? "" : "-e"]"
|
||||
|
||||
/obj/item/gun/ballistic/automatic/shotgun/bulldog/afterattack()
|
||||
@@ -298,6 +304,7 @@
|
||||
burst_shot_delay = 1
|
||||
spread = 7
|
||||
pin = /obj/item/firing_pin/implant/pindicate
|
||||
automatic_burst_overlay = FALSE
|
||||
|
||||
/obj/item/gun/ballistic/automatic/l6_saw/unrestricted
|
||||
pin = /obj/item/firing_pin
|
||||
@@ -316,7 +323,7 @@
|
||||
playsound(user, 'sound/weapons/sawclose.ogg', 60, 1)
|
||||
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" : ""]"
|
||||
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_out_amt = 13
|
||||
slot_flags = ITEM_SLOT_BACK
|
||||
automatic_burst_overlay = FALSE
|
||||
actions_types = list()
|
||||
|
||||
/obj/item/gun/ballistic/automatic/sniper_rifle/update_icon()
|
||||
/obj/item/gun/ballistic/automatic/sniper_rifle/update_icon_state()
|
||||
if(magazine)
|
||||
icon_state = "sniper-mag"
|
||||
else
|
||||
@@ -397,9 +405,10 @@
|
||||
can_suppress = TRUE
|
||||
w_class = WEIGHT_CLASS_HUGE
|
||||
slot_flags = ITEM_SLOT_BACK
|
||||
automatic_burst_overlay = FALSE
|
||||
actions_types = list()
|
||||
|
||||
/obj/item/gun/ballistic/automatic/surplus/update_icon()
|
||||
/obj/item/gun/ballistic/automatic/surplus/update_icon_state()
|
||||
if(magazine)
|
||||
icon_state = "surplus"
|
||||
else
|
||||
@@ -413,6 +422,7 @@
|
||||
icon_state = "oldrifle"
|
||||
item_state = "arg"
|
||||
mag_type = /obj/item/ammo_box/magazine/recharge
|
||||
automatic_burst_overlay = FALSE
|
||||
fire_delay = 2
|
||||
can_suppress = FALSE
|
||||
burst_size = 1
|
||||
@@ -420,7 +430,5 @@
|
||||
fire_sound = 'sound/weapons/laser.ogg'
|
||||
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]" : ""]"
|
||||
return
|
||||
|
||||
@@ -42,8 +42,7 @@
|
||||
actions_types = list()
|
||||
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" : ""]"
|
||||
|
||||
/obj/item/gun/ballistic/automatic/speargun
|
||||
@@ -54,6 +53,7 @@
|
||||
w_class = WEIGHT_CLASS_BULKY
|
||||
force = 10
|
||||
can_suppress = FALSE
|
||||
automatic_burst_overlay = FALSE
|
||||
mag_type = /obj/item/ammo_box/magazine/internal/speargun
|
||||
fire_sound = 'sound/weapons/grenadelaunch.ogg'
|
||||
burst_size = 1
|
||||
@@ -62,8 +62,9 @@
|
||||
actions_types = list()
|
||||
casing_ejector = FALSE
|
||||
|
||||
/obj/item/gun/ballistic/automatic/speargun/update_icon()
|
||||
return
|
||||
/obj/item/gun/ballistic/automatic/speargun/ComponentInitialize()
|
||||
. = ..()
|
||||
AddElement(/datum/element/update_icon_blocker)
|
||||
|
||||
/obj/item/gun/ballistic/automatic/speargun/attack_self()
|
||||
return
|
||||
@@ -137,7 +138,7 @@
|
||||
chamber_round()
|
||||
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"]"
|
||||
|
||||
/obj/item/gun/ballistic/rocketlauncher/suicide_act(mob/living/user)
|
||||
|
||||
@@ -75,8 +75,7 @@
|
||||
recoil = 2
|
||||
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"]"
|
||||
|
||||
///magpistol///
|
||||
@@ -92,12 +91,14 @@
|
||||
fire_delay = 2
|
||||
inaccuracy_modifier = 0.25
|
||||
cell_type = /obj/item/stock_parts/cell/magnetic/pistol
|
||||
automatic_burst_overlay = FALSE
|
||||
|
||||
/obj/item/gun/ballistic/automatic/magrifle/pistol/update_icon()
|
||||
..()
|
||||
cut_overlays()
|
||||
/obj/item/gun/ballistic/automatic/magrifle/pistol/update_overlays()
|
||||
. = ..()
|
||||
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"]"
|
||||
|
||||
/obj/item/gun/ballistic/automatic/magrifle/pistol/nopin
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
burst_size = 1
|
||||
fire_delay = 0
|
||||
actions_types = list()
|
||||
automatic_burst_overlay = FALSE
|
||||
|
||||
/obj/item/gun/ballistic/automatic/pistol/no_mag
|
||||
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" : ""]"
|
||||
|
||||
/obj/item/gun/ballistic/automatic/pistol/suppressed/Initialize(mapload)
|
||||
@@ -28,6 +28,7 @@
|
||||
icon = 'modular_citadel/icons/obj/guns/cit_guns.dmi'
|
||||
icon_state = "cde"
|
||||
can_unsuppress = TRUE
|
||||
automatic_burst_overlay = FALSE
|
||||
obj_flags = UNIQUE_RENAME
|
||||
unique_reskin = list("Default" = "cde",
|
||||
"N-99" = "n99",
|
||||
@@ -38,20 +39,18 @@
|
||||
"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)
|
||||
icon_state = "[unique_reskin[current_skin]][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
|
||||
else
|
||||
icon_state = "[initial(icon_state)][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
|
||||
|
||||
/obj/item/gun/ballistic/automatic/pistol/modular/update_overlays()
|
||||
. = ..()
|
||||
if(magazine && suppressed)
|
||||
cut_overlays()
|
||||
add_overlay("[unique_reskin[current_skin]]-magazine-sup") //Yes, this means the default iconstate can't have a magazine overlay
|
||||
. += "[unique_reskin[current_skin]]-magazine-sup" //Yes, this means the default iconstate can't have a magazine overlay
|
||||
else if (magazine)
|
||||
cut_overlays()
|
||||
add_overlay("[unique_reskin[current_skin]]-magazine")
|
||||
else
|
||||
cut_overlays()
|
||||
. += "[unique_reskin[current_skin]]-magazine"
|
||||
|
||||
/obj/item/gun/ballistic/automatic/pistol/m1911
|
||||
name = "\improper M1911"
|
||||
@@ -77,14 +76,14 @@
|
||||
force = 14
|
||||
mag_type = /obj/item/ammo_box/magazine/m50
|
||||
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)
|
||||
cut_overlays()
|
||||
add_overlay("deagle_magazine")
|
||||
else
|
||||
cut_overlays()
|
||||
. += "deagle_magazine"
|
||||
|
||||
/obj/item/gun/ballistic/automatic/pistol/deagle/update_icon_state()
|
||||
icon_state = "[initial(icon_state)][chambered ? "" : "-e"]"
|
||||
|
||||
/obj/item/gun/ballistic/automatic/pistol/deagle/gold
|
||||
@@ -142,14 +141,14 @@
|
||||
actions_types = list()
|
||||
fire_sound = 'sound/weapons/blastcannon.ogg'
|
||||
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)
|
||||
cut_overlays()
|
||||
add_overlay("atp-mag")
|
||||
else
|
||||
cut_overlays()
|
||||
. += "atp-mag"
|
||||
|
||||
/obj/item/gun/ballistic/automatic/pistol/antitank/update_icon_state()
|
||||
icon_state = "[initial(icon_state)][chambered ? "" : "-e"]"
|
||||
|
||||
/obj/item/gun/ballistic/automatic/pistol/antitank/syndicate
|
||||
|
||||
@@ -348,10 +348,10 @@
|
||||
else
|
||||
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)
|
||||
icon_state += "sling"
|
||||
. += "[icon_state]sling"
|
||||
|
||||
/obj/item/gun/ballistic/revolver/doublebarrel/improvised/sawoff(mob/user)
|
||||
. = ..()
|
||||
|
||||
@@ -164,10 +164,10 @@
|
||||
else
|
||||
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)
|
||||
icon_state += "sling"
|
||||
. += "[icon_state]sling"
|
||||
|
||||
/obj/item/gun/ballistic/shotgun/boltaction/enchanted
|
||||
name = "enchanted bolt action rifle"
|
||||
@@ -272,7 +272,7 @@
|
||||
spread = 2
|
||||
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"]"
|
||||
|
||||
//Dual Feed Shotgun
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
burst_size = 1
|
||||
fire_delay = 0
|
||||
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" : ""]"
|
||||
|
||||
/obj/item/gun/ballistic/automatic/toy/pistol/riot
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
var/charge_sections = 4
|
||||
ammo_x_offset = 2
|
||||
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/charge_tick = 0
|
||||
var/charge_delay = 4
|
||||
@@ -64,10 +63,20 @@
|
||||
START_PROCESSING(SSobj, src)
|
||||
update_icon()
|
||||
|
||||
/obj/item/gun/energy/ComponentInitialize()
|
||||
. = ..()
|
||||
AddElement(/datum/element/update_icon_updates_onmob)
|
||||
|
||||
/obj/item/gun/energy/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
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)
|
||||
. = ..()
|
||||
if(!right_click_overridden)
|
||||
@@ -226,46 +235,47 @@
|
||||
#undef DECREMENT_OR_WRAP
|
||||
#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))
|
||||
return
|
||||
..()
|
||||
if(!automatic_charge_overlays)
|
||||
return
|
||||
var/ratio = can_shoot() ? CEILING(clamp(cell.charge / cell.maxcharge, 0, 1) * charge_sections, 1) : 0
|
||||
// Sets the ratio to 0 if the gun doesn't have enough charge to fire, or if it's power cell is removed.
|
||||
// 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
|
||||
var/overlay_icon_state = "[icon_state]_charge"
|
||||
var/ratio = get_charge_ratio()
|
||||
if (modifystate)
|
||||
var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index]
|
||||
add_overlay("[icon_state]_[shot.select_name]")
|
||||
iconState += "_[shot.select_name]"
|
||||
if(itemState)
|
||||
itemState += "[shot.select_name]"
|
||||
. += "[icon_state]_[shot.select_name]"
|
||||
overlay_icon_state += "_[shot.select_name]"
|
||||
if(ratio == 0)
|
||||
add_overlay("[icon_state]_empty")
|
||||
. += "[icon_state]_empty"
|
||||
else
|
||||
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--)
|
||||
charge_overlay.pixel_x = ammo_x_offset * (i - 1)
|
||||
charge_overlay.pixel_y = ammo_y_offset * (i - 1)
|
||||
add_overlay(charge_overlay)
|
||||
. += charge_overlay
|
||||
else
|
||||
add_overlay("[icon_state]_charge[ratio]")
|
||||
if(itemState)
|
||||
itemState += "[ratio]"
|
||||
item_state = itemState
|
||||
if(ismob(loc)) //forces inhands to update
|
||||
var/mob/M = loc
|
||||
M.update_inv_hands()
|
||||
. += "[icon_state]_charge[ratio]"
|
||||
|
||||
///Used by update_icon_state() and update_overlays()
|
||||
/obj/item/gun/energy/proc/get_charge_ratio()
|
||||
return can_shoot() ? CEILING(clamp(cell.charge / cell.maxcharge, 0, 1) * charge_sections, 1) : 0
|
||||
// Sets the ratio to 0 if the gun doesn't have enough charge to fire, or if its power cell is removed.
|
||||
|
||||
/obj/item/gun/energy/suicide_act(mob/living/user)
|
||||
if (istype(user) && can_shoot() && can_trigger_gun(user) && user.get_bodypart(BODY_ZONE_HEAD))
|
||||
|
||||
@@ -207,12 +207,11 @@
|
||||
to_chat(user,"<span class='notice'>You switch [src] setting to [setting] mode.</span>")
|
||||
update_icon()
|
||||
|
||||
/obj/item/gun/energy/dueling/update_icon(force_update)
|
||||
/obj/item/gun/energy/dueling/update_overlays(force_update)
|
||||
. = ..()
|
||||
if(setting_overlay)
|
||||
cut_overlay(setting_overlay)
|
||||
setting_overlay.icon_state = setting_iconstate()
|
||||
add_overlay(setting_overlay)
|
||||
. += setting_overlay
|
||||
|
||||
/obj/item/gun/energy/dueling/Destroy()
|
||||
if(duel)
|
||||
@@ -363,8 +362,7 @@
|
||||
STR.max_items = 2
|
||||
STR.can_hold = typecacheof(/obj/item/gun/energy/dueling)
|
||||
|
||||
/obj/item/storage/lockbox/dueling/update_icon()
|
||||
cut_overlays()
|
||||
/obj/item/storage/lockbox/dueling/update_icon_state()
|
||||
var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)
|
||||
if(locked)
|
||||
icon_state = "medalbox+l"
|
||||
|
||||
@@ -19,17 +19,13 @@
|
||||
cell_type = /obj/item/stock_parts/cell{charge = 600; maxcharge = 600}
|
||||
ammo_x_offset = 2
|
||||
charge_sections = 3
|
||||
gunlight_state = "mini-light"
|
||||
can_flashlight = 0 // Can't attach or detach the flashlight, and override it's icon update
|
||||
|
||||
/obj/item/gun/energy/e_gun/mini/Initialize()
|
||||
gun_light = new /obj/item/flashlight/seclite(src)
|
||||
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
|
||||
name = "tactical energy gun"
|
||||
desc = "Military issue energy gun, is able to fire stun rounds."
|
||||
@@ -138,15 +134,15 @@
|
||||
return
|
||||
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)
|
||||
add_overlay("[icon_state]_fail_3")
|
||||
. += "[icon_state]_fail_3"
|
||||
else
|
||||
switch(fail_tick)
|
||||
if(0)
|
||||
add_overlay("[icon_state]_fail_0")
|
||||
. += "[icon_state]_fail_0"
|
||||
if(1 to 150)
|
||||
add_overlay("[icon_state]_fail_1")
|
||||
. += "[icon_state]_fail_1"
|
||||
if(151 to INFINITY)
|
||||
add_overlay("[icon_state]_fail_2")
|
||||
. += "[icon_state]_fail_2"
|
||||
|
||||
@@ -46,13 +46,6 @@
|
||||
range = 4
|
||||
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)
|
||||
var/old_fire_delay = fire_delay //It's pretty irrelevant tbh but whatever.
|
||||
fire_delay = overheat_time
|
||||
@@ -187,11 +180,9 @@
|
||||
overheat = FALSE
|
||||
|
||||
/obj/item/gun/energy/kinetic_accelerator/update_icon()
|
||||
..()
|
||||
. += ..()
|
||||
if(!can_shoot())
|
||||
add_overlay("[icon_state]_empty")
|
||||
else
|
||||
cut_overlays()
|
||||
. += "[icon_state]_empty"
|
||||
|
||||
//Casing
|
||||
/obj/item/ammo_casing/energy/kinetic
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
pin = null
|
||||
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]
|
||||
if(!QDELETED(cell) && (cell.charge > shot.e_cost))
|
||||
add_overlay("decloner_spin")
|
||||
. += "decloner_spin"
|
||||
|
||||
/obj/item/gun/energy/floragun
|
||||
name = "floral somatoray"
|
||||
@@ -134,9 +134,10 @@
|
||||
tool_behaviour = TOOL_WELDER
|
||||
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')
|
||||
AddElement(/datum/element/update_icon_blocker)
|
||||
|
||||
/obj/item/gun/energy/plasmacutter/examine(mob/user)
|
||||
. = ..()
|
||||
@@ -166,9 +167,6 @@
|
||||
/obj/item/gun/energy/plasmacutter/use(amount)
|
||||
return cell.use(amount * 100)
|
||||
|
||||
/obj/item/gun/energy/plasmacutter/update_icon()
|
||||
return
|
||||
|
||||
/obj/item/gun/energy/plasmacutter/adv
|
||||
name = "advanced plasma cutter"
|
||||
icon_state = "adv_plasmacutter"
|
||||
@@ -183,11 +181,12 @@
|
||||
icon_state = "wormhole_projector"
|
||||
pin = null
|
||||
inaccuracy_modifier = 0.25
|
||||
automatic_charge_overlays = FALSE
|
||||
var/obj/effect/portal/p_blue
|
||||
var/obj/effect/portal/p_orange
|
||||
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]"
|
||||
item_state = icon_state
|
||||
|
||||
@@ -256,8 +255,9 @@
|
||||
can_charge = 0
|
||||
use_cyborg_cell = 1
|
||||
|
||||
/obj/item/gun/energy/printer/update_icon()
|
||||
return
|
||||
/obj/item/gun/energy/printer/ComponentInitialize()
|
||||
. = ..()
|
||||
AddElement(/datum/element/update_icon_blocker)
|
||||
|
||||
/obj/item/gun/energy/printer/emp_act()
|
||||
return
|
||||
@@ -321,14 +321,14 @@
|
||||
inaccuracy_modifier = 0.25
|
||||
cell_type = /obj/item/stock_parts/cell/super
|
||||
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]
|
||||
if(!QDELETED(cell) && (cell.charge > shot.e_cost))
|
||||
add_overlay("emitter_carbine_empty")
|
||||
icon_state = "emitter_carbine_empty"
|
||||
else
|
||||
add_overlay("emitter_carbine")
|
||||
icon_state = "emitter_carbine"
|
||||
|
||||
//the pickle ray
|
||||
/obj/item/gun/energy/pickle_gun
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
slowdown = 1
|
||||
item_flags = NO_MAT_REDEMPTION | SLOWS_WHILE_IN_HAND | NEEDS_PERMIT
|
||||
pin = null
|
||||
automatic_charge_overlays = FALSE
|
||||
var/aiming = FALSE
|
||||
var/aiming_time = 14
|
||||
var/aiming_time_fire_threshold = 5
|
||||
@@ -152,13 +153,13 @@
|
||||
current_zoom_x = 0
|
||||
current_zoom_y = 0
|
||||
|
||||
/obj/item/gun/energy/beam_rifle/update_icon()
|
||||
cut_overlays()
|
||||
/obj/item/gun/energy/beam_rifle/update_overlays()
|
||||
. = ..()
|
||||
var/obj/item/ammo_casing/energy/primary_ammo = ammo_type[1]
|
||||
if(!QDELETED(cell) && (cell.charge > primary_ammo.e_cost))
|
||||
add_overlay(charged_overlay)
|
||||
. += charged_overlay
|
||||
else
|
||||
add_overlay(drained_overlay)
|
||||
. += drained_overlay
|
||||
|
||||
/obj/item/gun/energy/beam_rifle/attack_self(mob/user)
|
||||
if(!structure_piercing)
|
||||
|
||||
@@ -41,18 +41,16 @@
|
||||
user.put_in_hands(bomb)
|
||||
user.visible_message("<span class='warning'>[user] detaches [bomb] from [src].</span>")
|
||||
bomb = null
|
||||
name = initial(name)
|
||||
desc = initial(desc)
|
||||
update_icon()
|
||||
return ..()
|
||||
|
||||
/obj/item/gun/blastcannon/update_icon()
|
||||
/obj/item/gun/blastcannon/update_icon_state()
|
||||
if(bomb)
|
||||
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
|
||||
icon_state = initial(icon_state)
|
||||
name = initial(name)
|
||||
desc = initial(desc)
|
||||
|
||||
/obj/item/gun/blastcannon/attackby(obj/O, mob/user)
|
||||
if(istype(O, /obj/item/transfer_valve))
|
||||
@@ -65,6 +63,8 @@
|
||||
return FALSE
|
||||
user.visible_message("<span class='warning'>[user] attaches [T] to [src]!</span>")
|
||||
bomb = T
|
||||
name = "blast cannon"
|
||||
desc = "A makeshift device used to concentrate a bomb's blast energy to a narrow wave."
|
||||
update_icon()
|
||||
return TRUE
|
||||
return ..()
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
@@ -16,13 +16,12 @@
|
||||
spread = 20
|
||||
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)
|
||||
cut_overlays()
|
||||
add_overlay("foamsp-magazine")
|
||||
else
|
||||
cut_overlays()
|
||||
. += "foamsp-magazine"
|
||||
|
||||
/obj/item/gun/ballistic/automatic/toy/pistol/stealth/update_icon_state()
|
||||
icon_state = "[initial(icon_state)][chambered ? "" : "-e"]"
|
||||
|
||||
/////////RAYGUN MEMES/////////
|
||||
|
||||
@@ -155,11 +155,15 @@
|
||||
casing_ejector = 0
|
||||
spread = 10
|
||||
recoil = 0.05
|
||||
automatic_burst_overlay = FALSE
|
||||
var/magtype = "flechettegun"
|
||||
|
||||
/obj/item/gun/ballistic/automatic/flechette/update_icon()
|
||||
cut_overlays()
|
||||
/obj/item/gun/ballistic/automatic/flechette/update_overlays()
|
||||
. = ..()
|
||||
if(magazine)
|
||||
add_overlay("flechettegun-magazine")
|
||||
. += "[magtype]-magazine"
|
||||
|
||||
/obj/item/gun/ballistic/automatic/flechette/update_icon_state()
|
||||
icon_state = "[initial(icon_state)][chambered ? "" : "-e"]"
|
||||
|
||||
///unique variant///
|
||||
@@ -185,12 +189,7 @@
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
spread = 15
|
||||
recoil = 0.1
|
||||
|
||||
/obj/item/gun/ballistic/automatic/flechette/shredder/update_icon()
|
||||
cut_overlays()
|
||||
if(magazine)
|
||||
add_overlay("shreddergun-magazine")
|
||||
icon_state = "[initial(icon_state)][chambered ? "" : "-e"]"
|
||||
magtype = "shreddergun"
|
||||
|
||||
/*/////////////////////////////////////////////////////////////
|
||||
//////////////////////// Zero's Meme //////////////////////////
|
||||
@@ -218,17 +217,19 @@
|
||||
burst_size = 4 //Shh.
|
||||
fire_delay = 1
|
||||
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")
|
||||
if(body_color)
|
||||
body_overlay.color = body_color
|
||||
cut_overlays() //So that it doesn't keep stacking overlays non-stop on top of each other
|
||||
add_overlay(body_overlay)
|
||||
if(ismob(loc))
|
||||
var/mob/M = loc
|
||||
M.update_inv_hands()
|
||||
. += body_overlay
|
||||
|
||||
/obj/item/gun/ballistic/automatic/AM4B/AltClick(mob/living/user)
|
||||
. = ..()
|
||||
if(!in_range(src, user)) //Basic checks to prevent abuse
|
||||
|
||||
@@ -55,8 +55,7 @@
|
||||
/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
|
||||
|
||||
/obj/item/gun/ballistic/automatic/spinfusor/update_icon()
|
||||
..()
|
||||
/obj/item/gun/ballistic/automatic/spinfusor/update_icon_state()
|
||||
icon_state = "spinfusor[magazine ? "-[get_ammo(1)]" : ""]"
|
||||
|
||||
/obj/item/ammo_box/aspinfusor
|
||||
|
||||
@@ -14,16 +14,16 @@ obj/item/gun/energy/e_gun/cx
|
||||
flight_y_offset = 10
|
||||
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")
|
||||
if(body_color)
|
||||
body_overlay.color = body_color
|
||||
add_overlay(body_overlay)
|
||||
|
||||
if(ismob(loc))
|
||||
var/mob/M = loc
|
||||
M.update_inv_hands()
|
||||
. += body_overlay
|
||||
|
||||
obj/item/gun/energy/e_gun/cx/AltClick(mob/living/user)
|
||||
. = ..()
|
||||
|
||||
@@ -52,13 +52,13 @@
|
||||
if(has_shot)
|
||||
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]
|
||||
if(chambered)
|
||||
add_overlay("[icon_state]_rack_[shot.select_name]")
|
||||
. += "[icon_state]_rack_[shot.select_name]"
|
||||
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.
|
||||
var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index]
|
||||
|
||||
Reference in New Issue
Block a user