-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converting auras, cloaking and stasis into mob modifiers, something l…
…ike the HUD effect markers on Polaris.
- Loading branch information
1 parent
77bef4b
commit 7dabe31
Showing
159 changed files
with
1,487 additions
and
1,032 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#define PENDING_STATUS(MOB, COND) (LAZYACCESS(MOB.pending_status_counters, COND) || LAZYACCESS(MOB.status_counters, COND)) | ||
#define GET_STATUS(MOB, COND) (LAZYACCESS(MOB.status_counters, COND)) | ||
#define HAS_STATUS(MOB, COND) (GET_STATUS(MOB, COND) > 0) | ||
#define ADJ_STATUS(MOB, COND, AMT) (MOB.set_status(COND, PENDING_STATUS(MOB, COND) + AMT)) | ||
#define SET_STATUS_MAX(MOB, COND, AMT) (MOB.set_status(COND, max(PENDING_STATUS(MOB, COND), AMT))) | ||
#define ADJ_STATUS(MOB, COND, AMT) (MOB.set_status_condition(COND, PENDING_STATUS(MOB, COND) + AMT)) | ||
#define SET_STATUS_MAX(MOB, COND, AMT) (MOB.set_status_condition(COND, max(PENDING_STATUS(MOB, COND), AMT))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,3 @@ | ||
#define XENOFIND_APPLY_PREFIX BITFLAG(0) | ||
#define XENOFIND_APPLY_DECOR BITFLAG(1) | ||
#define XENOFIND_REPLACE_ICON BITFLAG(2) | ||
|
||
#define EFFECT_TOUCH 0 | ||
#define EFFECT_AURA 1 | ||
#define EFFECT_PULSE 2 | ||
#define MAX_EFFECT 2 | ||
|
||
#define EFFECT_UNKNOWN 0 | ||
#define EFFECT_ENERGY 1 | ||
#define EFFECT_PSIONIC 2 | ||
#define EFFECT_ELECTRO 3 | ||
#define EFFECT_PARTICLE 4 | ||
#define EFFECT_ORGANIC 5 | ||
#define EFFECT_SYNTH 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
/obj/screen/mob_modifier_master | ||
screen_loc = "CENTER,TOP" | ||
icon_state = "blank" | ||
requires_ui_style = FALSE | ||
|
||
// Disable these due to vis_contents behaving oddly with them. | ||
use_supplied_ui_color = FALSE | ||
use_supplied_ui_alpha = FALSE | ||
|
||
// TODO: consider pooling these. | ||
var/list/elements | ||
|
||
/obj/screen/mob_modifier_master/Initialize(mapload, mob/_owner, decl/ui_style/ui_style, ui_color, ui_alpha, ui_cat) | ||
. = ..() | ||
START_PROCESSING(SSprocessing, src) | ||
|
||
/obj/screen/mob_modifier_master/Destroy() | ||
STOP_PROCESSING(SSprocessing, src) | ||
QDEL_NULL_LIST(elements) | ||
return ..() | ||
|
||
/obj/screen/mob_modifier_master/Process() | ||
if(QDELETED(src)) | ||
return PROCESS_KILL | ||
var/mob/living/owner = owner_ref?.resolve() | ||
if(!istype(owner)) | ||
return PROCESS_KILL | ||
for(var/obj/screen/mob_modifier/element in elements) | ||
var/expire_time = MOB_MODIFIER_INDEFINITE | ||
for(var/datum/mob_modifier/modifier in LAZYACCESS(owner._mob_modifiers, element.archetype)) | ||
if(modifier.expire_time == MOB_MODIFIER_INDEFINITE) | ||
expire_time = MOB_MODIFIER_INDEFINITE | ||
break | ||
expire_time = max(expire_time, modifier.expire_time) | ||
if(istype(element)) | ||
element.update_maptext(expire_time == MOB_MODIFIER_INDEFINITE ? MOB_MODIFIER_INDEFINITE : (expire_time - world.time)) | ||
|
||
/obj/screen/mob_modifier_master/on_update_icon() | ||
|
||
if(QDELETED(src)) | ||
return | ||
|
||
var/mob/living/owner = owner_ref?.resolve() | ||
if(!istype(owner) || !istype(owner.hud_used)) | ||
return | ||
|
||
var/list/seen_archetypes | ||
var/list/elements_to_keep | ||
var/list/elements_to_add | ||
var/list/elements_to_remove | ||
|
||
// Track deltas for keeping/removing existing elements. | ||
for(var/obj/screen/mob_modifier/element in elements) | ||
var/list/modifiers = LAZYACCESS(owner._mob_modifiers, element.archetype) | ||
if(length(modifiers)) | ||
LAZYADD(elements_to_keep, element) | ||
else | ||
LAZYADD(elements_to_remove, element) | ||
LAZYDISTINCTADD(seen_archetypes, element.archetype) | ||
|
||
var/decl/ui_style/ui_style = owner.hud_used.get_ui_style_data() | ||
var/ui_color = owner.hud_used.get_ui_color() | ||
var/ui_alpha = owner.hud_used.get_ui_alpha() | ||
|
||
// Create elements for new modifiers. | ||
for(var/decl/mob_modifier/archetype in owner._mob_modifiers) | ||
if(archetype in seen_archetypes) | ||
continue | ||
var/obj/screen/mob_modifier/element = new(null, owner, ui_style, ui_color, ui_alpha, HUD_MODIFIERS) | ||
element.archetype = archetype | ||
element.master = src | ||
element.pixel_y = 32 | ||
element.alpha = 0 | ||
element.update_icon() | ||
LAZYADD(elements_to_add, element) | ||
|
||
// Fade out and delete expired markers. | ||
if(LAZYLEN(elements_to_remove)) | ||
LAZYREMOVE(elements, elements_to_remove) | ||
for(var/obj/screen/mob_modifier/element in elements_to_remove) | ||
animate(element, alpha = 0, pixel_y = 32, time = 5) | ||
QDEL_IN(element, 5) | ||
|
||
// Add our new records. | ||
if(LAZYLEN(elements_to_add)) | ||
LAZYADD(elements, elements_to_add) | ||
add_vis_contents(elements_to_add) | ||
|
||
// Adjust positions and fade in new elements. | ||
if(length(elements)) | ||
var/offset_x = -(((length(elements)-1) * (world.icon_size + 2)) / 2) | ||
for(var/obj/screen/element in elements) | ||
if(element in elements_to_add) | ||
pixel_x = offset_x | ||
animate(element, alpha = 255, pixel_y = 0, time = 5) | ||
else | ||
animate(element, alpha = 255, pixel_x = offset_x, pixel_y = 0, time = 5) | ||
offset_x += world.icon_size + 2 | ||
|
||
/obj/screen/mob_modifier | ||
alpha = 0 | ||
screen_loc = null // not handled via screen loc, but via vis contents of the master object. | ||
maptext_y = -3 | ||
icon_state = "modifier_base" | ||
var/decl/mob_modifier/archetype | ||
var/obj/screen/mob_modifier_master/master | ||
|
||
/obj/screen/mob_modifier/Destroy() | ||
if(master) | ||
LAZYREMOVE(master.elements, src) | ||
master.remove_vis_contents(src) | ||
master = null | ||
return ..() | ||
|
||
/obj/screen/mob_modifier/rebuild_screen_overlays() | ||
. = ..() | ||
if(archetype) | ||
add_overlay(overlay_image(archetype.hud_icon, archetype.hud_icon_state, COLOR_WHITE, RESET_COLOR)) | ||
|
||
/obj/screen/mob_modifier/proc/update_maptext(duration) | ||
if(archetype.hide_expiry) | ||
maptext = null | ||
return | ||
|
||
if(duration == MOB_MODIFIER_INDEFINITE) | ||
if(archetype.show_indefinite_duration) | ||
maptext = STYLE_SMALLFONTS_OUTLINE("<center>∞</center>", 12, COLOR_WHITE, COLOR_BLACK) | ||
else | ||
maptext = null | ||
else if(duration <= 0) | ||
maptext = STYLE_SMALLFONTS_OUTLINE("<center>0</center>", 7, COLOR_WHITE, COLOR_BLACK) | ||
else | ||
maptext = STYLE_SMALLFONTS_OUTLINE("<center>[ticks2shortreadable(duration) || 0]</center>", 7, COLOR_WHITE, COLOR_BLACK) | ||
|
||
/obj/screen/mob_modifier/handle_click(mob/user, params) | ||
if((. = ..())) | ||
var/mob/living/owner = owner_ref?.resolve() | ||
if(istype(owner) && archetype) | ||
var/list/modifiers = LAZYACCESS(owner._mob_modifiers, archetype) | ||
for(var/datum/mob_modifier/modifier in modifiers) | ||
modifier.on_modifier_click(params) | ||
return | ||
|
||
/obj/screen/mob_modifier/MouseEntered(location, control, params) | ||
if(archetype && (archetype.name || archetype.desc)) | ||
openToolTip(user = usr, tip_src = src, params = params, title = archetype.name, content = archetype.desc) | ||
..() | ||
|
||
/obj/screen/mob_modifier/MouseDown() | ||
closeToolTip(usr) | ||
..() | ||
|
||
/obj/screen/mob_modifier/MouseExited() | ||
closeToolTip(usr) | ||
..() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -603,3 +603,5 @@ | |
return TRUE | ||
return FALSE | ||
|
||
/atom/movable/proc/get_cryogenic_power() | ||
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.