-
-
Notifications
You must be signed in to change notification settings - Fork 550
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may not be viewable. --> <!-- You can view Contributing.MD for a detailed description of the pull request process. --> ## About The Pull Request You can now generate simple mob icons via corpse spawners and its cached so its not terribly expensive port of tgstation/tgstation#72517 and to fix some unit tests ports (which will also minorly improve init times i suspect) that changes how overlays render. tgstation/tgstation#69696 tgstation/tgstation#73965 tgstation/tgstation#71706 currently only applied to frontiersmen but its very simple to do it for any of them ![image](https://github.com/user-attachments/assets/a677e6c9-5279-4f17-ad82-c8e3a418bfbb) - [x] FIX THAT TEST BEFORE MERG <!-- Describe The Pull Request. Please be sure every change is documented or this can delay review and even discourage maintainers from merging your PR! --> ## Why It's Good For The Game No more ancient simple mob sprites once everything is moved over <!-- Please add a short description of why you think these changes would benefit the game. If you can't justify it in words, it might not be worth adding. --> ## Changelog :cl: FalloutFalcon, Fikou, a hood by Viro refactor: Humanoid mobs automatically generate their sprites, they no longer will be outdated. refactor: Ports some tg overlay improvments. /:cl: <!-- Both :cl:'s are required for the changelog to work! You can put your name to the right of the first :cl: if you want to overwrite your GitHub username as author ingame. --> <!-- You can use multiple of the same prefix (they're only used for the icon ingame) and delete the unneeded ones. Despite some of the tags, changelogs should generally represent how a player might be affected by the changes rather than a summary of the PR's contents. --> --------- Signed-off-by: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com>
- Loading branch information
1 parent
1f10735
commit c57da5b
Showing
26 changed files
with
427 additions
and
328 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* I do want this however this currently only fails on decals specificly in create and destroy. | ||
Updating the overlays in genral was already pretty unatomic.area | ||
I've added porting some updated decal code from tg to resolve this to my list. | ||
WARNING("Too many overlays on [changed_on.type] - [length(changed_on.overlays)], refusing to update and cutting.\ | ||
\n What follows is a printout of all existing overlays at the time of the overflow \n[text_lays]"); \ | ||
*/ | ||
|
||
// A reasonable number of maximum overlays an object needs | ||
// If you think you need more, rethink it | ||
#define MAX_ATOM_OVERLAYS 100 | ||
|
||
/// Checks if an atom has reached the overlay limit, and make a loud error if it does. | ||
#define VALIDATE_OVERLAY_LIMIT(changed_on) \ | ||
if(length(changed_on.overlays) >= MAX_ATOM_OVERLAYS) { \ | ||
changed_on.overlays.Cut(); \ | ||
} \ | ||
|
||
/// Performs any operations that ought to run after an appearance change | ||
#define POST_OVERLAY_CHANGE(changed_on) \ | ||
if(alternate_appearances) { \ | ||
for(var/I in changed_on.alternate_appearances){\ | ||
var/datum/atom_hud/alternate_appearance/AA = changed_on.alternate_appearances[I];\ | ||
if(AA.transfer_overlays){\ | ||
AA.copy_overlays(changed_on, TRUE);\ | ||
}\ | ||
} \ | ||
} |
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,65 @@ | ||
///Global list of all dynamically generated icons, for caching, so we don't have to generate multiple times. | ||
GLOBAL_LIST_EMPTY(dynamic_human_appearances) | ||
|
||
/// Creates a human with the given parameters and returns an appearance of it | ||
/proc/get_dynamic_human_appearance(outfit_path, species_path = /datum/species/human, mob_spawn_path, r_hand, l_hand, bloody_slots = NONE, animated = TRUE) | ||
if(!species_path) | ||
return FALSE | ||
if(!ispath(species_path)) | ||
stack_trace("Attempted to call get_dynamic_human_appearance() with an instantiated species_path. Pass the species datum typepath instead.") | ||
return FALSE | ||
var/arg_string = "[outfit_path]_[species_path]_[mob_spawn_path]_[l_hand]_[r_hand]_[bloody_slots]" | ||
if(GLOB.dynamic_human_appearances[arg_string]) //if already exists in our cache, just return that | ||
return GLOB.dynamic_human_appearances[arg_string] | ||
var/mob/living/carbon/human/dummy/consistent/dummy = new() | ||
dummy.set_species(species_path) | ||
dummy.stat = CONSCIOUS //He needs to be alive or he has no eyes. Scary | ||
dummy.underwear = "Nude" | ||
dummy.undershirt = "Nude" | ||
dummy.socks = "Nude" | ||
if(outfit_path) | ||
var/datum/outfit/outfit = new outfit_path() | ||
if(r_hand != NO_REPLACE) //we can still override to be null, no replace means just use outfit's | ||
outfit.r_hand = r_hand | ||
if(l_hand != NO_REPLACE) | ||
outfit.l_hand = l_hand | ||
dummy.equipOutfit(outfit, visualsOnly = TRUE) | ||
else if(mob_spawn_path) | ||
var/obj/effect/mob_spawn/human/spawner = new mob_spawn_path(null) | ||
if(r_hand != NO_REPLACE) | ||
spawner.r_hand = r_hand | ||
if(l_hand != NO_REPLACE) | ||
spawner.l_hand = l_hand | ||
spawner.special(dummy, dummy) | ||
spawner.equip(dummy) | ||
for(var/obj/item/carried_item in dummy) | ||
if(dummy.is_holding(carried_item)) | ||
var/datum/component/two_handed/twohanded = carried_item.GetComponent(/datum/component/two_handed) | ||
if(twohanded) | ||
twohanded.wield(dummy) | ||
/* | ||
var/datum/component/transforming/transforming = carried_item.GetComponent(/datum/component/transforming) | ||
if(transforming) | ||
transforming.set_active(carried_item) | ||
*/ | ||
if(bloody_slots & carried_item.slot_flags) | ||
carried_item.add_mob_blood(dummy) | ||
//dummy.update_held_items() | ||
dummy.regenerate_icons() | ||
var/mutable_appearance/output = dummy.appearance | ||
GLOB.dynamic_human_appearances[arg_string] = output | ||
qdel(dummy) | ||
return output | ||
|
||
///This exists to apply the icons async, as that cannot be done in Initialize because of possible sleeps. | ||
/proc/apply_dynamic_human_appearance(atom/target, outfit_path, species_path = /datum/species/human, mob_spawn_path, r_hand, l_hand, bloody_slots = NONE) | ||
INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(set_dynamic_human_appearance), args) | ||
|
||
///This proc gets an argument of a target and runs | ||
/proc/set_dynamic_human_appearance(list/arguments) | ||
var/atom/target = arguments[1] //1st argument is the target | ||
var/dynamic_appearance = get_dynamic_human_appearance(arglist(arguments.Copy(2))) //the rest of the arguments starting from 2 matter to the proc | ||
target.icon = 'icons/mob/human.dmi' | ||
target.icon_state = "" | ||
target.appearance_flags |= KEEP_TOGETHER | ||
target.copy_overlays(dynamic_appearance, TRUE) |
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
Oops, something went wrong.