Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _maps/map_files/rosewood/rosewood_forest.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@
/turf/open/floor/naturalstone,
/area/outdoors/woods)
"Ck" = (
/obj/effect/mob_spawn/human/corpse,
/obj/effect/mob_spawn/corpse/human,
/turf/open/floor/snow,
/area/outdoors/woods)
"Cp" = (
Expand Down
10 changes: 10 additions & 0 deletions code/__DEFINES/dcs/signals/signals_mob/signals_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,13 @@
#define COMPONENT_BLOCK_MOB_CHANGE (1<<0)
/// from /mob/proc/change_mob_type_unchecked() : ()
#define COMSIG_MOB_CHANGED_TYPE "mob_changed_type"

// signals for use by mob spawners
/// called when a spawner spawns a mob
#define COMSIG_SPAWNER_SPAWNED "spawner_spawned"

/// Called when a spawner spawns a mob in a turf peel, but we need to use the default case.
#define COMSIG_SPAWNER_SPAWNED_DEFAULT "spawner_spawned_default"

/// called when a ghost clicks a spawner role: (mob/living)
#define COMSIG_GHOSTROLE_SPAWNED "ghostrole_spawned"
13 changes: 13 additions & 0 deletions code/__DEFINES/mob_spawn.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
///this mob spawn creates the corpse instantly
#define CORPSE_INSTANT 1
///this mob spawn creates the corpse during GAME_STATE_PLAYING
#define CORPSE_ROUNDSTART 2

// Flags for using your static for a ghost role
/// Ghost role will take on the player's species
#define GHOSTROLE_TAKE_PREFS_SPECIES (1<<0)
/// Ghost role will take on the player's apperance (though exlcuding name)
#define GHOSTROLE_TAKE_PREFS_APPEARANCE (1<<1)

/// Return from create to stop the spawn process. Falsy value so one can just check !create()
#define CANCEL_SPAWN FALSE
3 changes: 3 additions & 0 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -389,3 +389,6 @@
#define FORBID_TELEKINESIS_REACH (1<<3)
/// If resting on the floor is allowed to perform action
#define ALLOW_RESTING (1<<4)

/// In dynamic human icon gen we don't replace the held item.
#define NO_REPLACE 0
66 changes: 66 additions & 0 deletions code/__HELPERS/dynamic_human_icon_gen.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
///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, combat_mode = 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]_[combat_mode]"
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 = DEAD //this is to avoid side effects of mob spawners
dummy.underwear = "Nude"
dummy.undershirt = "Nude"
dummy.socks = "Nude"
dummy.cmode = combat_mode

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, visuals_only = TRUE)
else if(mob_spawn_path)
var/obj/effect/mob_spawn/spawner = new mob_spawn_path(null, TRUE)
spawner.outfit_override = list()
if(r_hand != NO_REPLACE)
spawner.outfit_override["r_hand"] = r_hand
if(l_hand != NO_REPLACE)
spawner.outfit_override["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)
carried_item.add_mob_blood(dummy)

dummy.update_inv_hands()

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_state = ""
target.appearance_flags |= KEEP_TOGETHER
target.copy_overlays(dynamic_appearance, cut_old = TRUE)
53 changes: 30 additions & 23 deletions code/datums/dna.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,14 @@
unique_enzymes = generate_unique_enzymes()
holder?.reset_limb_fingerprints()

/datum/dna/proc/initialize_dna(newblood_type = random_human_blood_type(), skip_index = FALSE)
/datum/dna/proc/initialize_dna(newblood_type = random_human_blood_type(), create_mutation_blocks = TRUE, randomize_features = TRUE)
if(newblood_type)
human_blood_type = newblood_type
unique_enzymes = generate_unique_enzymes()
unique_identity = generate_unique_identity()
features = random_features()

if(create_mutation_blocks)
unique_enzymes = generate_unique_enzymes()
unique_identity = generate_unique_identity()
if(randomize_features)
features = random_features()

/datum/dna/stored //subtype used by brain mob's stored_dna

Expand All @@ -137,24 +138,30 @@
stored_dna.species = mrace //not calling any species update procs since we're a brain, not a monkey/human


/mob/living/carbon/set_species(datum/species/mrace, icon_update = TRUE, datum/preferences/pref_load = null)
if(mrace && has_dna())
var/datum/species/new_race
if(ispath(mrace))
new_race = new mrace
else if(istype(mrace))
new_race = mrace
else
return
deathsound = new_race.deathsound
dna.species.on_species_loss(src, new_race, pref_load)
var/datum/species/old_species = dna.species
dna.species = new_race
//BODYPARTS AND FEATURES
if(pref_load)
dna.features = pref_load.features.Copy()
dna.body_markings = deepCopyList(pref_load.body_markings)
dna.species.on_species_gain(src, old_species, pref_load)
/mob/living/carbon/set_species(datum/species/species, icon_update = TRUE, datum/preferences/pref_load = null)
if(!species || !has_dna())
return

var/datum/species/new_race
if(ispath(species))
new_race = new species
else if(istype(species))
new_race = species
else
return

deathsound = new_race.deathsound
dna.species.on_species_loss(src, new_race, pref_load)

var/datum/species/old_species = dna.species
dna.species = new_race

//BODYPARTS AND FEATURES
if(pref_load)
dna.features = pref_load.features.Copy()
dna.body_markings = deepCopyList(pref_load.body_markings)

dna.species.on_species_gain(src, old_species, pref_load)

/mob/living/carbon/human/set_species(datum/species/mrace, icon_update = TRUE, datum/preferences/pref_load = null)
if(pref_load)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/world_factions/_base.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
var/list/allowed_maps = list()

var/list/trader_outfits = list(
/obj/effect/mob_spawn/human/rakshari/trader
/obj/effect/mob_spawn/rakshari/trader
)

/// Chance for this faction to send a trader (0-100)
Expand Down
12 changes: 6 additions & 6 deletions code/datums/world_factions/coastal.dm
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/obj/effect/mob_spawn/human/demi
/obj/effect/mob_spawn/demi
mob_species = /datum/species/demihuman

Check failure on line 2 in code/datums/world_factions/coastal.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var 'mob_species' on type '/obj/effect/mob_spawn/demi'

/obj/effect/mob_spawn/human/demi/trader
/obj/effect/mob_spawn/demi/trader
outfit = /datum/outfit/bard

Check failure on line 5 in code/datums/world_factions/coastal.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var 'outfit' on type '/obj/effect/mob_spawn/demi/trader'

/obj/effect/mob_spawn/human/elf
/obj/effect/mob_spawn/elf
mob_species = /datum/species/elf/snow

Check failure on line 8 in code/datums/world_factions/coastal.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var 'mob_species' on type '/obj/effect/mob_spawn/elf'

/obj/effect/mob_spawn/human/elf/trader
/obj/effect/mob_spawn/elf/trader
outfit = /datum/outfit/bard

Check failure on line 11 in code/datums/world_factions/coastal.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var 'outfit' on type '/obj/effect/mob_spawn/elf/trader'

/datum/world_faction/coastal_merchants
faction_name = "Coastal Trade Union"
desc = "Seafaring traders with exotic wares"
faction_color = "#4682B4"
trader_outfits = list(
/obj/effect/mob_spawn/human/demi/trader,
/obj/effect/mob_spawn/human/elf/trader
/obj/effect/mob_spawn/demi/trader,
/obj/effect/mob_spawn/elf/trader
)
trader_type_weights = list(
/datum/trader_data/sake_merchant = 4,
Expand Down
6 changes: 3 additions & 3 deletions code/datums/world_factions/mountain.dm
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/obj/effect/mob_spawn/human/dwarf
/obj/effect/mob_spawn/dwarf
mob_species = /datum/species/dwarf/mountain

Check failure on line 2 in code/datums/world_factions/mountain.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var 'mob_species' on type '/obj/effect/mob_spawn/dwarf'

/obj/effect/mob_spawn/human/dwarf/trader
/obj/effect/mob_spawn/dwarf/trader
outfit = /datum/outfit/miner

Check failure on line 5 in code/datums/world_factions/mountain.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var 'outfit' on type '/obj/effect/mob_spawn/dwarf/trader'

/datum/world_faction/mountain_clans
faction_name = "Dwarven Clans"
desc = "Hardy dwarves from the mountain passes"
faction_color = "#708090"
trader_outfits = list(
/obj/effect/mob_spawn/human/dwarf/trader
/obj/effect/mob_spawn/dwarf/trader
)
trader_type_weights = list(
/datum/trader_data/weapon_merchant = 15,
Expand Down
6 changes: 3 additions & 3 deletions code/datums/world_factions/traders/banker.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/obj/effect/mob_spawn/human/rakshari
/obj/effect/mob_spawn/rakshari
mob_species = /datum/species/rakshari

/obj/effect/mob_spawn/human/rakshari/banker
/obj/effect/mob_spawn/rakshari/banker
outfit = /datum/outfit/tailor

Check failure on line 5 in code/datums/world_factions/traders/banker.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var 'outfit' on type '/obj/effect/mob_spawn/rakshari/banker'

/mob/living/simple_animal/hostile/retaliate/banker
name = "Banker"
Expand All @@ -24,7 +24,7 @@
///The currency name
var/currency_name = "zennies"
///The spawner we use to create our look
var/obj/effect/mob_spawn/human/spawner_path = /obj/effect/mob_spawn/human/rakshari/banker
var/obj/effect/mob_spawn/spawner_path = /obj/effect/mob_spawn/rakshari/banker
///Our species to create our look
var/species_path = /datum/species/human
///Casing used to shoot during retaliation
Expand Down
2 changes: 1 addition & 1 deletion code/datums/world_factions/traders/blacksmith.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
///The currency name
var/currency_name = "zennies"
///The spawner we use to create our look
var/obj/effect/mob_spawn/human/spawner_path = /obj/effect/mob_spawn/human/dwarf/trader
var/obj/effect/mob_spawn/spawner_path = /obj/effect/mob_spawn/dwarf/trader
///Our species to create our look
var/species_path = /datum/species/human
///Casing used to shoot during retaliation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
shoes = /obj/item/clothing/shoes/nobleboot/duelboots
pants = /obj/item/clothing/pants/trou/leathertights

/obj/effect/mob_spawn/human/elf/artifact
/obj/effect/mob_spawn/elf/artifact
outfit = /datum/outfit/artifact

/datum/trader_data/artifact_weapons
name = "Artifact"
outfit_override = list(/obj/effect/mob_spawn/human/elf/artifact)
outfit_override = list(/obj/effect/mob_spawn/elf/artifact)

initial_products = list()
max_custom_items = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
armor = /obj/item/clothing/shirt/robe/kimono
//cloak = /obj/item/clothing/cloak/raincloak/purple

/obj/effect/mob_spawn/human/trition
/obj/effect/mob_spawn/trition
mob_species = /datum/species/triton

/obj/effect/mob_spawn/human/trition/zhong
/obj/effect/mob_spawn/trition/zhong
outfit = /datum/outfit/zhongese

/datum/trader_data/sake_merchant
name = "Sake"
base_type = list()
initial_products = list()
outfit_override = list(/obj/effect/mob_spawn/human/trition/zhong)
outfit_override = list(/obj/effect/mob_spawn/trition/zhong)
max_custom_items = 6
custom_items = list(
/obj/item/reagent_containers/glass/bottle/black/huangjiu = list(3, 25, 3),
Expand Down Expand Up @@ -88,7 +88,7 @@
name = "Eastern Blades"
base_type = list()
initial_products = list()
outfit_override = list(/obj/effect/mob_spawn/human/trition/zhong)
outfit_override = list(/obj/effect/mob_spawn/trition/zhong)
max_custom_items = 6
custom_items = list(
/obj/item/weapon/sword/katana/mulyeog = list(3, 45, 3),
Expand Down
45 changes: 3 additions & 42 deletions code/datums/world_factions/traders/trader.dm
Original file line number Diff line number Diff line change
@@ -1,46 +1,7 @@
/// 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/mob/living/carbon/human/dummy/dummy = new()
dummy.set_species(species_path)
dummy.stat = DEAD //this is to avoid side effects of mob spawners
dummy.underwear = "Nude"
dummy.undershirt = "Nude"
dummy.socks = "Nude"
if(outfit_path)
var/datum/outfit/outfit = new outfit_path()
dummy.equipOutfit(outfit, TRUE)
else if(mob_spawn_path)
var/obj/effect/mob_spawn/spawner = new mob_spawn_path(null, TRUE)
spawner.special(dummy, dummy)
spawner.equip(dummy)
for(var/obj/item/carried_item in dummy)
if(bloody_slots & carried_item.slot_flags)
carried_item.add_mob_blood(dummy)
var/mutable_appearance/output = dummy.appearance
qdel(dummy)
return output

/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/human.dmi'
target.icon_state = ""
target.appearance_flags |= KEEP_TOGETHER
target.copy_overlays(dynamic_appearance, cut_old = TRUE)

/obj/effect/mob_spawn/human/rakshari
/obj/effect/mob_spawn/rakshari
mob_species = /datum/species/rakshari

Check failure on line 2 in code/datums/world_factions/traders/trader.dm

View workflow job for this annotation

GitHub Actions / Run Linters

undefined var 'mob_species' on type '/obj/effect/mob_spawn/rakshari'

/obj/effect/mob_spawn/human/rakshari/trader
/obj/effect/mob_spawn/rakshari/trader
outfit = /datum/outfit/tailor

/mob/living/simple_animal/hostile/retaliate/trader
Expand Down Expand Up @@ -69,7 +30,7 @@
///The currency name
var/currency_name = "zennies"
///The spawner we use to create our look
var/obj/effect/mob_spawn/human/spawner_path = /obj/effect/mob_spawn/human/rakshari/trader
var/obj/effect/mob_spawn/spawner_path = /obj/effect/mob_spawn/rakshari/trader
///Our species to create our look
var/species_path = /datum/species/human
///Casing used to shoot during retaliation
Expand Down
Loading
Loading