From 2fd2f962382bc8c0b6e8d06d63238f3b9ff11ba9 Mon Sep 17 00:00:00 2001 From: phil235 Date: Tue, 22 Sep 2015 02:14:37 +0200 Subject: [PATCH] Simplified update_mutations_overlay(), we no longer rebuild the entire mutation layer with all mutations every time we get or lose a mutation. I reintroduced in on_acquiring and on_losing some code similar to the old lose_indication gain_indication procs. Fixed lesser form changeling, when humanized via dna injector, the ling no longer keeps its Human Form power. Simplified the racemut trick in humanize() and monkeyize(). Dna now gets qdel'd, just like reagents, when the mob gets qdel'd. Some tiny fixes here and there. Added a changelog. --- code/datums/mutations.dm | 49 +++++++++++-------- code/game/dna.dm | 2 +- .../gamemodes/changeling/evolution_menu.dm | 2 - .../changeling/powers/digitalcamo.dm | 4 ++ .../objects/items/weapons/dna_injector.dm | 2 +- code/modules/events/radiation_storm.dm | 3 +- code/modules/events/wizard/imposter.dm | 1 + code/modules/mob/living/carbon/carbon.dm | 2 + code/modules/mob/transform_procs.dm | 12 +++-- html/changelogs/phil235-DnaMonkeyStuff.yml | 12 +++++ 10 files changed, 58 insertions(+), 31 deletions(-) create mode 100644 html/changelogs/phil235-DnaMonkeyStuff.yml diff --git a/code/datums/mutations.dm b/code/datums/mutations.dm index dab76ebf7d9a..64ff70e3eef6 100644 --- a/code/datums/mutations.dm +++ b/code/datums/mutations.dm @@ -16,7 +16,7 @@ var/text_gain_indication = "" var/text_lose_indication = "" var/list/visual_indicators = list() - var/above_body = 0 //wether the mutation appear above or below the body layer + var/layer_used = MUTATIONS_LAYER //which mutation layer to use var/list/species_allowed = list() //to restrict mutation to only certain species var/health_req //minimum health required to acquire the mutation @@ -62,7 +62,13 @@ if(text_gain_indication) owner << text_gain_indication if(visual_indicators.len) - owner.update_mutations_overlay() + var/list/mut_overlay = list(get_visual_indicator(owner)) + if(owner.overlays_standing[layer_used]) + mut_overlay = owner.overlays_standing[layer_used] + mut_overlay |= get_visual_indicator(owner) + owner.remove_overlay(layer_used) + owner.overlays_standing[layer_used] = mut_overlay + owner.apply_overlay(layer_used) /datum/mutation/human/proc/get_visual_indicator(mob/living/carbon/human/owner) return @@ -84,7 +90,13 @@ if(text_lose_indication) owner << text_lose_indication if(visual_indicators.len) - owner.update_mutations_overlay() + var/list/mut_overlay = list() + if(owner.overlays_standing[layer_used]) + mut_overlay = owner.overlays_standing[layer_used] + owner.remove_overlay(layer_used) + mut_overlay.Remove(get_visual_indicator(owner)) + owner.overlays_standing[layer_used] = mut_overlay + owner.apply_overlay(layer_used) return 0 return 1 @@ -596,7 +608,7 @@ quality = POSITIVE dna_block = NON_SCANNABLE text_gain_indication = "You feel pressure building up behind your eyes." - above_body = 1 + layer_used = FRONT_MUTATIONS_LAYER /datum/mutation/human/laser_eyes/New() ..() @@ -609,29 +621,24 @@ if(owner.a_intent == "harm") owner.LaserEyes(target) + /mob/living/carbon/proc/update_mutations_overlay() return /mob/living/carbon/human/update_mutations_overlay() - remove_overlay(MUTATIONS_LAYER) //MUTATIONS_LAYER is behind the body layer - remove_overlay(FRONT_MUTATIONS_LAYER) //FRONT_MUTATIONS_LAYER is above the body layer - var/list/standing = list() - var/list/frontstanding = list() - for(var/datum/mutation/human/CM in dna.mutations) if(CM.species_allowed.len && !CM.species_allowed.Find(dna.species.id)) - CM.force_lose(src) + CM.force_lose(src) //shouldn't have that mutation at all continue if(CM.visual_indicators.len) + var/list/mut_overlay = list() + if(overlays_standing[CM.layer_used]) + mut_overlay = overlays_standing[CM.layer_used] var/image/V = CM.get_visual_indicator(src) - if(CM.above_body) - frontstanding += V - else - standing += V - - if(standing.len) - overlays_standing[MUTATIONS_LAYER] = standing - if(frontstanding.len) - overlays_standing[FRONT_MUTATIONS_LAYER] = frontstanding - apply_overlay(MUTATIONS_LAYER) - apply_overlay(FRONT_MUTATIONS_LAYER) + if(!mut_overlay.Find(V)) //either we lack the visual indicator or we have the wrong one + remove_overlay(CM.layer_used) + for(var/image/I in CM.visual_indicators) + mut_overlay.Remove(I) + mut_overlay |= V + overlays_standing[CM.layer_used] = mut_overlay + apply_overlay(CM.layer_used) diff --git a/code/game/dna.dm b/code/game/dna.dm index 59ae91cce503..33615f83cfbb 100644 --- a/code/game/dna.dm +++ b/code/game/dna.dm @@ -320,7 +320,7 @@ mob/living/carbon/human/updateappearance(icon_update=1, mutcolor_update=0, mutat for(var/i=1, i<=DNA_UNI_IDENTITY_BLOCKS, i++) if(prob(probability)) M.dna.uni_identity = setblock(M.dna.uni_identity, i, random_string(DNA_BLOCK_SIZE, hex_characters)) - M.updateappearance() + M.updateappearance(mutations_overlay_update=1) return 1 //value in range 1 to values. values must be greater than 0 diff --git a/code/game/gamemodes/changeling/evolution_menu.dm b/code/game/gamemodes/changeling/evolution_menu.dm index e42e1fad6412..d9f6faa94572 100644 --- a/code/game/gamemodes/changeling/evolution_menu.dm +++ b/code/game/gamemodes/changeling/evolution_menu.dm @@ -388,8 +388,6 @@ var/list/sting_paths /mob/proc/remove_changeling_powers(keep_free_powers=0) if(ishuman(src) || ismonkey(src)) if(mind && mind.changeling) - digitalcamo = 0 - digitalinvis = 0 mind.changeling.changeling_speak = 0 mind.changeling.reset() for(var/obj/effect/proc_holder/changeling/p in mind.changeling.purchasedpowers) diff --git a/code/game/gamemodes/changeling/powers/digitalcamo.dm b/code/game/gamemodes/changeling/powers/digitalcamo.dm index 13bf62bdbc47..79651c98a973 100644 --- a/code/game/gamemodes/changeling/powers/digitalcamo.dm +++ b/code/game/gamemodes/changeling/powers/digitalcamo.dm @@ -18,3 +18,7 @@ feedback_add_details("changeling_powers","CAM") return 1 + +/obj/effect/proc_holder/changeling/digitalcamo/on_refund(mob/user) + user.digitalcamo = 0 + user.digitalinvis = 0 \ No newline at end of file diff --git a/code/game/objects/items/weapons/dna_injector.dm b/code/game/objects/items/weapons/dna_injector.dm index 960b38ad0bac..28afa0a7bb81 100644 --- a/code/game/objects/items/weapons/dna_injector.dm +++ b/code/game/objects/items/weapons/dna_injector.dm @@ -38,7 +38,7 @@ M.dna.blood_type = fields["blood_type"] if(fields["UI"]) //UI+UE M.dna.uni_identity = merge_text(M.dna.uni_identity, fields["UI"]) - M.updateappearance() + M.updateappearance(mutations_overlay_update=1) log_attack(log_msg) else user << "It appears that [M] does not have compatible DNA." diff --git a/code/modules/events/radiation_storm.dm b/code/modules/events/radiation_storm.dm index 1857a625da0c..c83ea419df48 100644 --- a/code/modules/events/radiation_storm.dm +++ b/code/modules/events/radiation_storm.dm @@ -43,10 +43,9 @@ if(prob(25)) if(prob(75)) randmutb(H) - H.domutcheck() else randmutg(H) - H.domutcheck() + H.domutcheck() else if(istype(C, /mob/living/carbon/monkey)) var/mob/living/carbon/monkey/M = C diff --git a/code/modules/events/wizard/imposter.dm b/code/modules/events/wizard/imposter.dm index fdfdd98f4510..9a1558304557 100644 --- a/code/modules/events/wizard/imposter.dm +++ b/code/modules/events/wizard/imposter.dm @@ -21,6 +21,7 @@ I.real_name = I.dna.real_name I.name = I.dna.real_name I.updateappearance(mutcolor_update=1) + I.domutcheck() if(W.ears) I.equip_to_slot_or_del(new W.ears.type, slot_ears) if(W.w_uniform) I.equip_to_slot_or_del(new W.w_uniform.type , slot_w_uniform) if(W.shoes) I.equip_to_slot_or_del(new W.shoes.type, slot_shoes) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 6a001457d30e..ff959f6c940b 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -22,6 +22,8 @@ for(var/atom/movable/food in stomach_contents) qdel(food) remove_from_all_data_huds() + if(dna) + qdel(dna) return ..() /mob/living/carbon/Move(NewLoc, direct) diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 9d5515a900a1..ff7b09b66323 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -48,8 +48,8 @@ if(tr_flags & TR_KEEPSE) O.dna.struc_enzymes = dna.struc_enzymes - var/datum/mutation/human/race/R = mutations_list[RACEMUT] //we don't want to keep the race block inactive - O.dna.struc_enzymes = setblock(O.dna.struc_enzymes, R.dna_block, random_string(DNA_BLOCK_SIZE, list("8","9","a","b","c","d","e", "f"))) + var/datum/mutation/human/race/R = mutations_list[RACEMUT] + O.dna.struc_enzymes = R.set_se(O.dna.struc_enzymes, on=1)//we don't want to keep the race block inactive if(suiciding) O.suiciding = suiciding @@ -166,8 +166,8 @@ if(tr_flags & TR_KEEPSE) O.dna.struc_enzymes = dna.struc_enzymes - var/datum/mutation/human/race/R = mutations_list[RACEMUT] //we don't want to keep the race block active - O.dna.struc_enzymes = setblock(O.dna.struc_enzymes, R.dna_block, random_string(DNA_BLOCK_SIZE, list("0","1","2","3","4","5","6"))) + var/datum/mutation/human/race/R = mutations_list[RACEMUT] + O.dna.struc_enzymes = R.set_se(O.dna.struc_enzymes, on=0)//we don't want to keep the race block active O.domutcheck() if(suiciding) @@ -208,6 +208,10 @@ if(mind) mind.transfer_to(O) + if(O.mind.changeling) + for(var/obj/effect/proc_holder/changeling/humanform/HF in O.mind.changeling.purchasedpowers) + mind.changeling.purchasedpowers -= HF + O.a_intent = "help" if (tr_flags & TR_DEFAULTMSG) O << "You are now a human." diff --git a/html/changelogs/phil235-DnaMonkeyStuff.yml b/html/changelogs/phil235-DnaMonkeyStuff.yml new file mode 100644 index 000000000000..cee62b62a22c --- /dev/null +++ b/html/changelogs/phil235-DnaMonkeyStuff.yml @@ -0,0 +1,12 @@ +author: phil235 +delete-after: True + +changes: + - rscdel: "Lizards and other non human species can no longer acquire the hulk mutation. Hulks no longer have red eyes" + - bugfix: "Monkeys now always have dna and a blood type (compatible with humans)." + - bugfix: "Monkey transformation no longer deletes the human's clothes." + - bugfix: "Space Retrovirus now correctly transfers dna SE to the infected human." + - bugfix: "Changeling's Anatomic Panacea removes alien embryo again." + - bugfix: "Cloning someone now correctly sets up their dna UE." + - bugfix: "Fixes the laser eyes mutation not giving glowing red eyes to the human." + - bugfix: "Using changeling readaptation now properly removes all evolutions bought (arm blade, chameleon skin, organic suit)."