Merge pull request #11259 from Ghommie/Ghommie-cit590
Porting update_icon improvements.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
|
||||
/datum/action/proc/link_to(Target)
|
||||
target = Target
|
||||
RegisterSignal(Target, COMSIG_ATOM_UPDATED_ICON, .proc/OnUpdatedIcon)
|
||||
|
||||
/datum/action/Destroy()
|
||||
if(owner)
|
||||
@@ -153,6 +154,9 @@
|
||||
var/mob/M = target
|
||||
M.ghostize(1)
|
||||
|
||||
/datum/action/proc/OnUpdatedIcon()
|
||||
UpdateButtonIcon()
|
||||
|
||||
//Presets for item actions
|
||||
/datum/action/item_action
|
||||
check_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUN|AB_CHECK_LYING|AB_CHECK_CONSCIOUS
|
||||
@@ -824,4 +828,4 @@
|
||||
for(var/datum/action/A in M.actions)
|
||||
if(istype(A, action_type))
|
||||
return A
|
||||
return
|
||||
return
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/examine)
|
||||
RegisterSignal(parent, COMSIG_PARENT_ATTACKBY, .proc/applyplate)
|
||||
RegisterSignal(parent, COMSIG_PARENT_PREQDELETED, .proc/dropplates)
|
||||
if(istype(parent, /obj/mecha/working/ripley))
|
||||
RegisterSignal(parent, COMSIG_ATOM_UPDATE_OVERLAYS, .proc/apply_mech_overlays)
|
||||
|
||||
if(_maxamount)
|
||||
maxamount = _maxamount
|
||||
@@ -75,4 +77,13 @@
|
||||
/datum/component/armor_plate/proc/dropplates(datum/source, force)
|
||||
if(ismecha(parent)) //items didn't drop the plates before and it causes erroneous behavior for the time being with collapsible helmets
|
||||
for(var/i in 1 to amount)
|
||||
new upgrade_item(get_turf(parent))
|
||||
new upgrade_item(get_turf(parent))
|
||||
|
||||
/datum/component/armor_plate/proc/apply_mech_overlays(obj/mecha/mech, list/overlays)
|
||||
if(amount)
|
||||
var/overlay_string = "ripley-g"
|
||||
if(amount >= 3)
|
||||
overlay_string += "-full"
|
||||
if(!mech.occupant)
|
||||
overlay_string += "-open"
|
||||
overlays += overlay_string
|
||||
|
||||
10
code/datums/elements/update_icon_blocker.dm
Normal file
10
code/datums/elements/update_icon_blocker.dm
Normal file
@@ -0,0 +1,10 @@
|
||||
//Prevents calling anything in update_icon() like update_icon_state() or update_overlays()
|
||||
|
||||
/datum/element/update_icon_blocker/Attach(datum/target)
|
||||
. = ..()
|
||||
if(!istype(target, /atom))
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
RegisterSignal(target, COMSIG_ATOM_UPDATE_ICON, .proc/block_update_icon)
|
||||
|
||||
/datum/element/update_icon_blocker/proc/block_update_icon()
|
||||
return COMSIG_ATOM_NO_UPDATE_ICON_STATE | COMSIG_ATOM_NO_UPDATE_OVERLAYS
|
||||
16
code/datums/elements/update_icon_updates_onmob.dm
Normal file
16
code/datums/elements/update_icon_updates_onmob.dm
Normal file
@@ -0,0 +1,16 @@
|
||||
//update_icon() may change the onmob icons
|
||||
//Very good name, I know
|
||||
|
||||
/datum/element/update_icon_updates_onmob/Attach(datum/target)
|
||||
. = ..()
|
||||
if(!istype(target, /obj/item))
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
RegisterSignal(target, COMSIG_ATOM_UPDATED_ICON, .proc/update_onmob)
|
||||
|
||||
/datum/element/update_icon_updates_onmob/proc/update_onmob(obj/item/target)
|
||||
if(ismob(target.loc))
|
||||
var/mob/M = target.loc
|
||||
if(M.is_holding(target))
|
||||
M.update_inv_hands()
|
||||
else
|
||||
M.regenerate_icons() //yeah this is shit, but we don't know which update_foo() proc to call instead so we'll call them all
|
||||
Reference in New Issue
Block a user