Dynamic Human Icon Generation For Simple/Basic Mobs (& Cardboard Cutouts) (#72517)

## About The Pull Request
revive of #68760
this time a proc, not an element
this time supports cardboard cutouts
this time supports mob corpses

![image](https://user-images.githubusercontent.com/23585223/211064291-81070650-189f-4afa-8116-81b687e3ea35.png)

## Why It's Good For The Game
prevents these icons ever being outdated, they'll always look what they
are supposed to, saves spriting work

## Changelog
🆑 Fikou, a hood by Viro
refactor: humanoid mobs and cardboard cutouts automatically generate
their sprites, they no longer will be outdated
/🆑

Co-authored-by: Time-Green <timkoster1@hotmail.com>
This commit is contained in:
Fikou
2023-01-18 21:04:10 +01:00
committed by GitHub
parent b520d5342f
commit 519bf69869
55 changed files with 804 additions and 475 deletions
+41
View File
@@ -366,6 +366,47 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava)
. = ..()
. += " | trait name: [trait_name]"
///This helper applies dynamic human icons to things on the map
/obj/effect/mapping_helpers/atom_injector/human_icon_injector
name = "Human Icon Injector"
icon_state = "icon"
/// Path of the outfit we give the human.
var/outfit_path
/// Path of the species we give the human.
var/species_path = /datum/species/human
/// Path of the mob spawner we base the human off of.
var/mob_spawn_path
/// Path of the right hand item we give the human.
var/r_hand = NO_REPLACE
/// Path of the left hand item we give the human.
var/l_hand = NO_REPLACE
/// Which slots on the mob should be bloody?
var/bloody_slots = NONE
/// Directions we generate for the mob.
var/generated_dirs = list(NORTH, SOUTH, EAST, WEST)
/// Do we draw more than one frame for the mob?
var/animated = TRUE
/obj/effect/mapping_helpers/atom_injector/human_icon_injector/check_validity()
if(!ispath(species_path, /datum/species))
CRASH("Wrong species path in [type] - [species_path] is not a species")
if(outfit_path && !ispath(outfit_path, /datum/outfit))
CRASH("Wrong outfit path in [type] - [species_path] is not an outfit")
if(mob_spawn_path && !ispath(mob_spawn_path, /obj/effect/mob_spawn))
CRASH("Wrong mob spawn path in [type] - [mob_spawn_path] is not a mob spawner")
if(l_hand && !ispath(l_hand, /obj/item))
CRASH("Wrong left hand item path in [type] - [l_hand] is not an item")
if(r_hand && !ispath(r_hand, /obj/item))
CRASH("Wrong left hand item path in [type] - [r_hand] is not an item")
return TRUE
/obj/effect/mapping_helpers/atom_injector/human_icon_injector/inject(atom/target)
apply_dynamic_human_icon(target, outfit_path, species_path, mob_spawn_path, r_hand, l_hand, bloody_slots, generated_dirs, animated)
/obj/effect/mapping_helpers/atom_injector/human_icon_injector/generate_stack_trace()
. = ..()
. += " | outfit path: [outfit_path] | species path: [species_path] | mob spawner path: [mob_spawn_path] | right/left hand path: [r_hand]/[l_hand]"
///Fetches an external dmi and applies to the target object
/obj/effect/mapping_helpers/atom_injector/custom_icon
name = "Custom Icon Injector"