Skip to content

Commit

Permalink
bugfix: DNA and Embedded Fixes (#5095)
Browse files Browse the repository at this point in the history
* DNA and Embedded Fixes

* As Anything
  • Loading branch information
Gottfrei authored Jun 3, 2024
1 parent 9b1af72 commit 45dff6a
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 49 deletions.
2 changes: 1 addition & 1 deletion code/game/dna/dna2.dm
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ GLOBAL_LIST_EMPTY(bad_blocks)
// Initial DNA setup. I'm kind of wondering why the hell this doesn't just call the above.
// ready_dna is (hopefully) only used on mob creation, and sets the struc_enzymes_original and SE_original only once - Bone White

/datum/dna/proc/ready_dna(mob/living/carbon/human/character, flatten_SE = 1)
/datum/dna/proc/ready_dna(mob/living/carbon/human/character, flatten_SE = TRUE)

ResetUIFrom(character)

Expand Down
13 changes: 9 additions & 4 deletions code/game/dna/dna2_domutcheck.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
* Returns TRUE if any changes were made, FALSE otherwise
*/
/mob/living/carbon/human/proc/update_gene_status(datum/dna/gene/gene, flags = NONE)
if(!gene.block)
return FALSE

// If human mob has no DNA its better runtime to tell us,
// since its involves some hacky code elsewhere
if(!dna)
Expand Down Expand Up @@ -93,8 +96,10 @@
* Arguments:
* * block - block to manipulate with.
* * activate - `TRUE` for activate, `FALSE` for deactivate.
* * update_default_status - whether to add/removes this block in/from `gene default_genes` variable.
* * update_default_status - whether to add/remove this block in/from `gene default_genes` variable.
* * ignore_species_default - if `TRUE` gene will be always removed, even if it belongs to `species default_genes` variable.
*
* Returns `TRUE` if a gene was changed, `FALSE` otherwise.
*/
/mob/proc/force_gene_block(block, activate = FALSE, update_default_status = FALSE, ignore_species_default = FALSE)
return
Expand All @@ -104,9 +109,9 @@
var/force_flags = MUTCHK_FORCED
if(ignore_species_default)
force_flags |= MUTCHK_IGNORE_DEFAULT
dna.SetSEState(block, activate, TRUE)
check_gene_block(block, force_flags)
if(update_default_status)
dna.SetSEState(block, activate)
. = check_gene_block(block, force_flags)
if(. && update_default_status)
if(activate)
LAZYOR(dna.default_blocks, block)
else
Expand Down
6 changes: 2 additions & 4 deletions code/game/dna/genes/gene.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
SHOULD_CALL_PARENT(TRUE)
LAZYOR(mutant.active_genes, type)
mutant.gene_stability -= instability
if(OnDrawUnderlays())
mutant.update_mutations()
mutant.update_mutations()


/**
Expand All @@ -61,8 +60,7 @@
SHOULD_CALL_PARENT(TRUE)
LAZYREMOVE(mutant.active_genes, type)
mutant.gene_stability += instability
if(OnDrawUnderlays())
mutant.update_mutations()
mutant.update_mutations()


// This section inspired by goone's bioEffects.
Expand Down
4 changes: 2 additions & 2 deletions code/game/dna/genes/monkey.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@


/datum/dna/gene/monkey/can_activate(mob/living/mutant, flags)
return ishuman(mutant) && !ismonkeybasic(mutant)
return ishuman(mutant) && !ismonkeybasic(mutant) && !HAS_TRAIT(mutant, TRAIT_NO_TRANSFORM)


/datum/dna/gene/monkey/can_deactivate(mob/living/mutant, flags)
return ishuman(mutant) && ismonkeybasic(mutant)
return ishuman(mutant) && ismonkeybasic(mutant) && !HAS_TRAIT(mutant, TRAIT_NO_TRANSFORM)


/datum/dna/gene/monkey/activate(mob/living/carbon/human/mutant, flags)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/antagonists/changeling/powers/lesserform.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

user.visible_message(span_warning("[user] transforms!"), span_warning("Our genes cry out!"))
remove_changeling_mutations(user)
user.monkeyize()
user.force_gene_block(GLOB.monkeyblock, TRUE)

cling.give_power(new /datum/action/changeling/humanform)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/client/preference/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2886,7 +2886,7 @@ GLOBAL_LIST_INIT(special_role_times, list( //minimum age (in days) for accounts
if(character.dna.dirtySE)
character.dna.UpdateSE()

character.dna.ready_dna(character, flatten_SE = 0)
character.dna.ready_dna(character, flatten_SE = FALSE)
character.sync_organ_dna(assimilate=1)
character.UpdateAppearance()

Expand Down
6 changes: 3 additions & 3 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1199,15 +1199,15 @@
* Arguments:
* * new_species - The new species to assign.
*/
/mob/living/carbon/human/proc/setup_dna(datum/species/new_species)
/mob/living/carbon/human/proc/setup_dna(datum/species/new_species, flatten_SE = TRUE)
set_species(new_species, use_default_color = TRUE, delay_icon_update = TRUE, skip_same_check = TRUE)
// Name
real_name = dna.species.get_random_name(gender)
name = real_name
mind?.name = real_name

// DNA ready
dna.ready_dna(src)
dna.ready_dna(src, flatten_SE)
dna.real_name = real_name
dna.tts_seed_dna = tts_seed
sync_organ_dna()
Expand Down Expand Up @@ -1244,7 +1244,7 @@
* * transfer_special_internals - If `TRUE`, all special internal organs (implants, spider eggs, xeno embryos, etc.), will be present on the mob post-change. Does not affect racial internal organs (heart, liver, etc.).
* * save_appearance - If `TRUE`, all bodyparts appearances (head hair style, body tattoos, tail type, etc.) will be transfered to new species.
*/
/mob/living/carbon/human/proc/set_species(datum/species/new_species, use_default_color, delay_icon_update = FALSE, skip_same_check = FALSE, retain_damage = FALSE, transformation = FALSE, keep_missing_bodyparts = FALSE, transfer_special_internals = TRUE, save_appearance = FALSE)
/mob/living/carbon/human/proc/set_species(datum/species/new_species, use_default_color = FALSE, delay_icon_update = FALSE, skip_same_check = FALSE, retain_damage = FALSE, transformation = FALSE, keep_missing_bodyparts = FALSE, transfer_special_internals = TRUE, save_appearance = FALSE)
if(!skip_same_check && dna.species.name == initial(new_species.name))
return

Expand Down
10 changes: 7 additions & 3 deletions code/modules/mob/living/carbon/human/human_organs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,14 @@
var/mob/living/holder = thing.loc
holder.drop_item_ground(thing)

if(embedded_zone && !get_organ(embedded_zone))
embedded_zone = BODY_ZONE_CHEST
var/obj/item/organ/external/bodypart
if(embedded_zone)
bodypart = get_organ(embedded_zone)
if(!bodypart)
bodypart = get_organ(BODY_ZONE_CHEST)
else
bodypart = safepick(bodyparts)

var/obj/item/organ/external/bodypart = embedded_zone ? embedded_zone : safepick(bodyparts)
if(!bodypart)
return FALSE

Expand Down
32 changes: 20 additions & 12 deletions code/modules/mob/living/carbon/human/monkey.dm
Original file line number Diff line number Diff line change
@@ -1,37 +1,45 @@
/mob/living/carbon/human/lesser
var/master_commander = null //переменная хранящая владельца "животного"
icon = 'icons/mob/monkey.dmi' // for mappers
var/master_commander = null
var/sentience_type = SENTIENCE_ORGANIC
//holder_type = /obj/item/holder/monkey //Задыхается сидя на голове или в сумке, временно отключен

/mob/living/carbon/human/lesser/Initialize(mapload, species)
icon = null
. = ..(mapload, species)

/mob/living/carbon/human/lesser/setup_dna(datum/species/new_species)
/mob/living/carbon/human/lesser/setup_dna(datum/species/new_species, flatten_SE = FALSE)
. = ..()
dna.SetSEState(GLOB.monkeyblock, TRUE)
// since we are created as monkas we need to manually set our GLOB.monkeyblock as activated
// and also we are skipping SE flattening for the same reasons
LAZYOR(active_genes, /datum/dna/gene/monkey)

/mob/living/carbon/human/lesser/monkey
icon_state = "monkey1"

/mob/living/carbon/human/lesser/monkey/Initialize(mapload)
. = ..(mapload, /datum/species/monkey)
tts_seed = "Sniper"

/mob/living/carbon/human/lesser/farwa
icon_state = "tajkey1"

/mob/living/carbon/human/lesser/farwa/Initialize(mapload)
. = ..(mapload, /datum/species/monkey/tajaran)
tts_seed = "Gyro"
//holder_type = /obj/item/holder/farwa

/mob/living/carbon/human/lesser/wolpin
icon_state = "wolfling"

/mob/living/carbon/human/lesser/wolpin/Initialize(mapload)
. = ..(mapload, /datum/species/monkey/vulpkanin)
tts_seed = "Bloodseeker"
//holder_type = /obj/item/holder/farwa

/mob/living/carbon/human/lesser/neara
icon_state = "skrellkey1"

/mob/living/carbon/human/lesser/neara/Initialize(mapload)
. = ..(mapload, /datum/species/monkey/skrell)
tts_seed = "Bounty"
//holder_type = /obj/item/holder/neara

/mob/living/carbon/human/lesser/stok
icon_state = "stokkey1"

/mob/living/carbon/human/lesser/stok/Initialize(mapload)
. = ..(mapload, /datum/species/monkey/unathi)
tts_seed = "Witchdoctor"
//holder_type = /obj/item/holder/stok
5 changes: 5 additions & 0 deletions code/modules/mob/living/carbon/human/species/monkey.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@
H.meatleft = initial(H.meatleft)


/datum/species/monkey/handle_dna(mob/living/carbon/human/H, remove)
. = ..()
H.force_gene_block(GLOB.monkeyblock, !remove)


/datum/species/monkey/can_understand(mob/other)
return istype(other, /mob/living/simple_animal/hostile/gorilla)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ GLOBAL_LIST_EMPTY(damage_icon_parts)
if(gender == FEMALE)
g = "f"
// DNA2 - Drawing underlays.
for(var/datum/dna/gene/gene in GLOB.dna_genes)
for(var/datum/dna/gene/gene as anything in GLOB.dna_genes)
if(!gene.block)
continue
if(gene.is_active(src))
Expand Down
37 changes: 20 additions & 17 deletions code/modules/reagents/chemistry/reagents/toxins.dm
Original file line number Diff line number Diff line change
Expand Up @@ -279,35 +279,38 @@
color = "#7DFF00"
taste_description = "slime"


/datum/reagent/stable_mutagen/on_new(data)
..()
START_PROCESSING(SSprocessing, src)


/datum/reagent/stable_mutagen/Destroy()
STOP_PROCESSING(SSprocessing, src)
return ..()

/datum/reagent/stable_mutagen/on_mob_life(mob/living/M)
if(!ishuman(M) || !M.dna)
return
if(isnucleation(M))
return ..()
M.apply_effect(1, IRRADIATE, negate_armor = 1)
if(current_cycle == 10 && islist(data))
if(istype(data["dna"], /datum/dna))
var/mob/living/carbon/human/H = M
var/datum/dna/D = data["dna"]
if(!D.species.is_small)
H.change_dna(D, TRUE, TRUE)
H.special_post_clone_handling()

/datum/reagent/stable_mutagen/on_mob_life(mob/living/carbon/human/target)
if(isnucleation(target))
return ..()
target.apply_effect(1, IRRADIATE, negate_armor = TRUE)
if(current_cycle != 10 || !ishuman(target) || !target.dna || !islist(data) || !istype(data["dna"], /datum/dna))
return ..()
var/datum/dna/reagent_dna = data["dna"]
if(!reagent_dna.species.is_small)
target.change_dna(reagent_dna, TRUE, TRUE)
target.special_post_clone_handling()
return ..()


/datum/reagent/stable_mutagen/process()
if(..())
var/datum/reagent/blood/B = locate() in holder.reagent_list
if(B && islist(B.data) && !data)
data = B.data.Copy()
. = ..()
if(data)
return .
var/datum/reagent/blood/blood = locate() in holder.reagent_list
if(blood && islist(blood.data))
data = blood.data.Copy()


/datum/reagent/uranium
name ="Uranium"
Expand Down

0 comments on commit 45dff6a

Please sign in to comment.