Skip to content

Commit

Permalink
доработка x10
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoonij authored Dec 10, 2024
1 parent c0c05bc commit ded00d4
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 40 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1200,3 +1200,6 @@
/// Source: /mob/living/simple_animal/borer, listening in datum/antagonist/borer
#define COMSIG_BORER_ENTERED_HOST "borer_on_enter" // when borer entered host
#define COMSIG_BORER_LEFT_HOST "borer_on_leave" // when borer left host

/// Source: /proc/random_hair_style (mob/living/carbon/human/human, valid_hairstyles, h_style, robohead)
#define COMSIG_RANDOM_HAIR_STYLE "random_hair_style"
28 changes: 9 additions & 19 deletions code/__HELPERS/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,33 +46,23 @@

return pick(valid_picks)

/proc/random_hair_style(gender, species = SPECIES_HUMAN, datum/robolimb/robohead, mob/living/carbon/human/H)
/proc/random_hair_style(gender, species = SPECIES_HUMAN, datum/robolimb/robohead, mob/living/carbon/human/human)
var/h_style = "Bald"
var/list/valid_hairstyles = list()

for(var/hairstyle in GLOB.hair_styles_public_list)
var/datum/sprite_accessory/S = GLOB.hair_styles_public_list[hairstyle]
var/datum/sprite_accessory/style = GLOB.hair_styles_public_list[hairstyle]

if(hairstyle == "Bald") //Just in case.
valid_hairstyles += hairstyle
if(!LAZYIN(style.species_allowed, species))
continue
if(gender == S.unsuitable_gender)

if(gender == style.unsuitable_gender)
continue
if(species == SPECIES_MACNINEPERSON) //If the user is a species who can have a robotic head...
if(!robohead)
robohead = GLOB.all_robolimbs["Morpheus Cyberkinetics"]
if((species in S.species_allowed) && robohead.is_monitor && ((S.models_allowed && (robohead.company in S.models_allowed)) || !S.models_allowed)) //If this is a hair style native to the user's species, check to see if they have a head with an ipc-style screen and that the head's company is in the screen style's allowed models list.
valid_hairstyles += hairstyle //Give them their hairstyles if they do.
else
if(!robohead.is_monitor && (SPECIES_HUMAN in S.species_allowed)) /*If the hairstyle is not native to the user's species and they're using a head with an ipc-style screen, don't let them access it.
But if the user has a robotic humanoid head and the hairstyle can fit humans, let them use it as a wig. */
valid_hairstyles += hairstyle
else //If the user is not a species who can have robotic heads, use the default handling.
if(species in S.species_allowed) //If the user's head is of a species the hairstyle allows, add it to the list.
valid_hairstyles += hairstyle

LAZYADD(valid_hairstyles, hairstyle)

if(valid_hairstyles.len)
h_style = pick(valid_hairstyles)
h_style = safepick(valid_hairstyles)
SEND_SIGNAL(human, COMSIG_RANDOM_HAIR_STYLE, valid_hairstyles, h_style, robohead)

return h_style

Expand Down
53 changes: 41 additions & 12 deletions code/modules/mob/living/carbon/human/species/machine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -102,39 +102,68 @@
JOB_MIN_AGE_COMMAND = 15,
)

/datum/species/machine/on_species_gain(mob/living/carbon/human/H)
/datum/species/machine/on_species_gain(mob/living/carbon/human/human)
. = ..()
var/datum/action/innate/change_monitor/monitor = locate() in H.actions
var/datum/action/innate/change_monitor/monitor = locate() in human.actions

if(!monitor)
monitor = new
monitor.Grant(H)
monitor = new()
monitor.Grant(H)
monitor.Grant(human)

var/datum/atom_hud/data/human/medical/advanced/medhud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
medhud.remove_from_hud(H)
add_verb(H, list(
medhud.remove_from_hud(human)

add_verb(human, list(
/mob/living/carbon/human/proc/emote_ping,
/mob/living/carbon/human/proc/emote_beep,
/mob/living/carbon/human/proc/emote_buzz,
/mob/living/carbon/human/proc/emote_buzz2,
/mob/living/carbon/human/proc/emote_yes,
/mob/living/carbon/human/proc/emote_no))

RegisterSignal(human, COMSIG_RANDOM_HAIR_STYLE, PROC_REF(handle_random_hairstyle))

/datum/species/machine/proc/handle_random_hairstyle(
mob/living/carbon/human/human,
valid_hairstyles,
h_style,
datum/robolimb/robohead
)
SIGNAL_HANDLER

if(!robohead)
robohead = GLOB.all_robolimbs["Morpheus Cyberkinetics"]

for(var/hairstyle in GLOB.hair_styles_public_list)
var/datum/sprite_accessory/style = GLOB.hair_styles_public_list[hairstyle]

/datum/species/machine/on_species_loss(mob/living/carbon/human/H)
if(robohead.is_monitor && ((style.models_allowed && (robohead.company in S.models_allowed)) || !style.models_allowed))

Check failure on line 140 in code/modules/mob/living/carbon/human/species/machine.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var: "S"

Check warning on line 140 in code/modules/mob/living/carbon/human/species/machine.dm

View workflow job for this annotation

GitHub Actions / Run Linters

field access requires static type: "models_allowed"
LAZYADD(valid_hairstyles, hairstyle)

else
if(!robohead.is_monitor && (SPECIES_HUMAN in style.species_allowed)) // Let use them as wigs
LAZYADD(valid_hairstyles, hairstyle)

h_style = safepick(valid_hairstyles)

/datum/species/machine/on_species_loss(mob/living/carbon/human/human)
. = ..()
var/datum/action/innate/change_monitor/monitor = locate() in H.actions
monitor?.Remove(H)
var/datum/action/innate/change_monitor/monitor = locate() in human.actions
monitor?.Remove(human)

var/datum/atom_hud/data/human/medical/advanced/medhud = GLOB.huds[DATA_HUD_MEDICAL_ADVANCED]
medhud.add_to_hud(H)
remove_verb(H, list(
medhud.add_to_hud(human)

remove_verb(human, list(
/mob/living/carbon/human/proc/emote_ping,
/mob/living/carbon/human/proc/emote_beep,
/mob/living/carbon/human/proc/emote_buzz,
/mob/living/carbon/human/proc/emote_buzz2,
/mob/living/carbon/human/proc/emote_yes,
/mob/living/carbon/human/proc/emote_no))

UnregisterSignal(human, COMSIG_RANDOM_HAIR_STYLE)

// Allows IPC's to change their monitor display
/datum/action/innate/change_monitor
name = "Change Monitor"
Expand Down
20 changes: 11 additions & 9 deletions code/modules/surgery/organs/subtypes/wryn.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@

return ..(carbon)

/obj/item/organ/internal/wryn/hivenode/insert(mob/living/carbon/human/M, special = ORGAN_MANIPULATION_DEFAULT)
/obj/item/organ/internal/wryn/hivenode/insert(mob/living/carbon/human/human, special = ORGAN_MANIPULATION_DEFAULT)
. = ..()
M.add_language(LANGUAGE_WRYN)
var/obj/item/organ/external/head/head_organ = M.get_organ(BODY_ZONE_HEAD)
human.add_language(LANGUAGE_WRYN)
var/obj/item/organ/external/head/head_organ = human.get_organ(BODY_ZONE_HEAD)

head_organ.h_style = hair_style
M.update_hair()
human.update_hair()

/obj/item/organ/internal/wryn/hivenode/remove(mob/living/carbon/human/M, special = ORGAN_MANIPULATION_DEFAULT)
M.remove_language(LANGUAGE_WRYN)
var/obj/item/organ/external/head/head_organ = M.get_organ(BODY_ZONE_HEAD)
/obj/item/organ/internal/wryn/hivenode/remove(mob/living/carbon/human/human, special = ORGAN_MANIPULATION_DEFAULT)
human.remove_language(LANGUAGE_WRYN)
var/obj/item/organ/external/head/head_organ = human.get_organ(BODY_ZONE_HEAD)

head_organ.h_style = "Bald"
M.update_hair()
. = ..()
human.update_hair()

return ..()

/obj/item/organ/internal/wryn/glands
species_type = /datum/species/wryn
Expand Down

0 comments on commit ded00d4

Please sign in to comment.