Files
Bubberstation/code/modules/admin/create_mob.dm
MrMelbert 59288d1a97 Kills spec_updatehealth, replaces it with use of COMSIG_LIVING_HEALTH_UPDATE (#78772)
## About The Pull Request

Quick refactor, replaces `spec_updatehealth` with use of
`COMSIG_LIVING_HEALTH_UPDATE`.

`spec_updatehealth` was only used by one species, ethereals, and it was
used in a (in my opinion) janky way by calling `spec_updatehealth`
constantly.

This has one downside - `COMSIG_LIVING_HEALTH_UPDATE` is NOT sent if the
mob is in godmode, while `spec_updatehealth` was, which means godmoded
ethereals may not update 100% accurately according to their health
before entering godmode, but I doubt this will come into play often at
all.

- [x] I tested this PR

## Why It's Good For The Game

`updatehealth` is kinda hot, not turbo hot but a little hot, so this
helps performance a bit.

## Changelog

🆑 Melbert
refactor: Refactors how ethereals update their color when damaged. 
/🆑
2023-10-06 16:03:43 -06:00

34 lines
1.6 KiB
Plaintext

/datum/admins/proc/create_mob(mob/user)
var/static/create_mob_html
if (!create_mob_html)
var/mobjs = null
mobjs = jointext(typesof(/mob), ";")
create_mob_html = file2text('html/create_object.html')
create_mob_html = replacetext(create_mob_html, "Create Object", "Create Mob")
create_mob_html = replacetext(create_mob_html, "null /* object types */", "\"[mobjs]\"")
user << browse(create_panel_helper(create_mob_html), "window=create_mob;size=425x475")
/**
* Randomizes everything about a human, including DNA and name
*/
/proc/randomize_human(mob/living/carbon/human/human, randomize_mutations = FALSE)
human.gender = human.dna.species.sexes ? pick(MALE, FEMALE, PLURAL, NEUTER) : PLURAL
human.physique = human.gender
human.real_name = human.dna?.species.random_name(human.gender) || random_unique_name(human.gender)
human.name = human.get_visible_name()
human.set_hairstyle(random_hairstyle(human.gender), update = FALSE)
human.set_facial_hairstyle(random_facial_hairstyle(human.gender), update = FALSE)
human.set_haircolor("#[random_color()]", update = FALSE)
human.set_facial_haircolor(human.hair_color, update = FALSE)
human.eye_color_left = random_eye_color()
human.eye_color_right = human.eye_color_left
human.skin_tone = random_skin_tone()
human.dna.species.randomize_active_underwear_only(human)
// Needs to be called towards the end to update all the UIs just set above
human.dna.initialize_dna(newblood_type = random_blood_type(), create_mutation_blocks = randomize_mutations, randomize_features = TRUE)
// Snowflake for Ethereals
human.updatehealth()
human.updateappearance(mutcolor_update = TRUE)