Skip to content

Commit

Permalink
Merge pull request tgstation#11769 from phil235/FixMutations
Browse files Browse the repository at this point in the history
Some dna fixes
  • Loading branch information
Razharas committed Sep 15, 2015
2 parents da32139 + c958866 commit 73db851
Show file tree
Hide file tree
Showing 31 changed files with 906 additions and 899 deletions.
4 changes: 2 additions & 2 deletions code/datums/datacore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ var/record_id_num = 1001
var/datum/data/record/M = new()
M.fields["id"] = id
M.fields["name"] = H.real_name
M.fields["blood_type"] = H.blood_type
M.fields["blood_type"] = H.dna.blood_type
M.fields["b_dna"] = H.dna.unique_enzymes
M.fields["mi_dis"] = "None"
M.fields["mi_dis_d"] = "No minor disabilities have been declared."
Expand Down Expand Up @@ -255,7 +255,7 @@ var/record_id_num = 1001
L.fields["rank"] = H.mind.assigned_role
L.fields["age"] = H.age
L.fields["sex"] = H.gender
L.fields["blood_type"] = H.blood_type
L.fields["blood_type"] = H.dna.blood_type
L.fields["b_dna"] = H.dna.unique_enzymes
L.fields["enzymes"] = H.dna.struc_enzymes
L.fields["identity"] = H.dna.uni_identity
Expand Down
69 changes: 42 additions & 27 deletions code/datums/mutations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,16 @@
. = on_losing(owner)

/datum/mutation/human/proc/on_acquiring(mob/living/carbon/human/owner)
if(!owner || (src in owner.dna.mutations))
if(!owner || !istype(owner) || (src in owner.dna.mutations))
return 1
owner.dna.mutations.Add(src)
gain_indication(owner)
owner << text_gain_indication
if(visual_indicators.len)
owner.update_mutation_overlays()

/datum/mutation/human/proc/get_visual_indicator(mob/living/carbon/human/owner)
return

/datum/mutation/human/proc/gain_indication(mob/living/carbon/human/owner)
owner.overlays.Add(visual_indicators)
/*
var/list/result_overlays = list()
var/list/limbs = owner_get_limbs(NON_MECHANICAL|NON_AMPUTATED) //I dunno how its done by RR but i assume something like this, proc that returns the list of limbs based on what types of limbs to return in argument
for(var/obj/limb/L in limbs)
result_overlays[L.identificator] = visual_indicators[L.identificator] //visual_indicators is where overlays icons are stored, they are all created on new of each mutation, i assume you will change it to linked list for easyness, but for now its just a list
return owner.redraw_overlays(result_overlays, MUTATION_LAYER) //Currently mutations draw the overlays themselves but i assume if dismemberment will be overriding lots of shit like maybe clothes or something else mutations will just pass the shit to redraw proc
*/
/datum/mutation/human/proc/lose_indication(mob/living/carbon/human/owner)
owner.overlays.Remove(visual_indicators)

Expand All @@ -80,9 +75,10 @@
return

/datum/mutation/human/proc/on_losing(mob/living/carbon/human/owner)
if(owner && (owner.dna.mutations.Remove(src)))
lose_indication(owner)
if(owner && istype(owner) && (owner.dna.mutations.Remove(src)))
owner << text_lose_indication
if(visual_indicators.len)
owner.update_mutation_overlays()
return 0
return 1

Expand All @@ -107,16 +103,17 @@
visual_indicators |= image("icon"='icons/effects/genetics.dmi', "icon_state"="hulk_m_s", "layer"=-MUTATIONS_LAYER)

/datum/mutation/human/hulk/on_acquiring(mob/living/carbon/human/owner)
if(..()) return
if(..())
return
var/status = CANSTUN | CANWEAKEN | CANPARALYSE | CANPUSH
owner.status_flags &= ~status

/datum/mutation/human/hulk/on_attack_hand(mob/living/carbon/human/owner, atom/target)
return target.attack_hulk(owner)

/datum/mutation/human/hulk/gain_indication(mob/living/carbon/human/owner)
/datum/mutation/human/hulk/get_visual_indicator(mob/living/carbon/human/owner)
var/g = (owner.gender == FEMALE) ? 1 : 2
owner.overlays += visual_indicators[g]
return visual_indicators[g]

/datum/mutation/human/hulk/on_life(mob/living/carbon/human/owner)
if(owner.health < 25)
Expand Down Expand Up @@ -147,6 +144,9 @@
..()
visual_indicators |= image("icon"='icons/effects/genetics.dmi', "icon_state"="telekinesishead_s", "layer"=-MUTATIONS_LAYER)

/datum/mutation/human/telekinesis/get_visual_indicator(mob/living/carbon/human/owner)
return visual_indicators[1]

/datum/mutation/human/telekinesis/on_ranged_attack(mob/living/carbon/human/owner, atom/target)
target.attack_tk(owner)

Expand All @@ -162,6 +162,9 @@
..()
visual_indicators |= image("icon"='icons/effects/genetics.dmi', "icon_state"="fire_s", "layer"=-MUTATIONS_LAYER)

/datum/mutation/human/cold_resistance/get_visual_indicator(mob/living/carbon/human/owner)
return visual_indicators[1]

/datum/mutation/human/cold_resistance/on_life(mob/living/carbon/human/owner)
if(owner.getFireLoss())
if(prob(1))
Expand All @@ -176,7 +179,8 @@
text_gain_indication = "<span class='notice'>The walls suddenly disappear!</span>"

/datum/mutation/human/x_ray/on_acquiring(mob/living/carbon/human/owner)
if(..()) return
if(..())
return
on_life(owner)

/datum/mutation/human/x_ray/on_life(mob/living/carbon/human/owner)
Expand Down Expand Up @@ -335,19 +339,13 @@
quality = NEGATIVE

/datum/mutation/human/race/on_acquiring(mob/living/carbon/human/owner)
if(..()) return
if(..())
return
. = owner.monkeyize(TR_KEEPITEMS | TR_KEEPIMPLANTS | TR_KEEPORGANS | TR_KEEPDAMAGE | TR_KEEPVIRUS | TR_KEEPSE)

/datum/mutation/human/race/gain_indication(mob/living/carbon/human/owner)
return

/datum/mutation/human/race/lose_indication(mob/living/carbon/monkey/owner)
return

/datum/mutation/human/race/on_losing(mob/living/carbon/monkey/owner)
if(..())
return
. = owner.humanize(TR_KEEPITEMS | TR_KEEPIMPLANTS | TR_KEEPORGANS | TR_KEEPDAMAGE | TR_KEEPVIRUS | TR_KEEPSE)
if(owner && istype(owner) && (owner.dna.mutations.Remove(src)))
. = owner.humanize(TR_KEEPITEMS | TR_KEEPIMPLANTS | TR_KEEPORGANS | TR_KEEPDAMAGE | TR_KEEPVIRUS | TR_KEEPSE)


/datum/mutation/human/stealth
Expand Down Expand Up @@ -597,3 +595,20 @@
if(owner.a_intent == "harm")
owner.LaserEyes(target)


/mob/living/carbon/human/proc/update_mutation_overlays()
remove_overlay(MUTATIONS_LAYER)
var/image/standing

for(var/datum/mutation/human/CM in dna.mutations)
if(CM.visual_indicators.len)
var/image/V = CM.get_visual_indicator(src)
if(!standing)
standing = V
else
standing.overlays += V

if(standing)
overlays_standing[MUTATIONS_LAYER] = standing
apply_overlay(MUTATIONS_LAYER)

2 changes: 2 additions & 0 deletions code/datums/spells/genetic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
/obj/effect/proc_holder/spell/targeted/genetic/cast(list/targets)
playMagSound()
for(var/mob/living/carbon/target in targets)
if(!target.dna)
continue
for(var/A in mutations)
target.dna.add_mutation(A)
target.disabilities |= disabilities
Expand Down
4 changes: 2 additions & 2 deletions code/game/dna.dm
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@
if(connected && connected.is_operational())
if(connected.occupant) //set occupant_status message
viable_occupant = connected.occupant
if(check_dna_integrity(viable_occupant) && (!(NOCLONE in viable_occupant.mutations) || (connected.scan_level == 3))) //occupent is viable for dna modification
if(check_dna_integrity(viable_occupant) && (!(viable_occupant.disabilities & NOCLONE) || (connected.scan_level == 3))) //occupent is viable for dna modification
occupant_status += "[viable_occupant.name] => "
switch(viable_occupant.stat)
if(CONSCIOUS) occupant_status += "<span class='good'>Conscious</span>"
Expand Down Expand Up @@ -755,7 +755,7 @@
var/mob/living/carbon/viable_occupant
if(connected)
viable_occupant = connected.occupant
if(!istype(viable_occupant) || !viable_occupant.dna || (NOCLONE in viable_occupant.mutations))
if(!istype(viable_occupant) || !viable_occupant.dna || (viable_occupant.disabilities & NOCLONE))
viable_occupant = null

//Basic Tasks///////////////////////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/PDApainter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@
user << "<span class='warning'>There is already a PDA inside!</span>"
return
else
var/obj/item/device/pda/P = usr.get_active_hand()
var/obj/item/device/pda/P = user.get_active_hand()
if(istype(P))
if(!user.drop_item())
return
storedpda = P
P.loc = src
P.add_fingerprint(usr)
P.add_fingerprint(user)
update_icon()


Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/Operating.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
/obj/machinery/computer/operating/proc/get_patient_info()
var/dat = {"
<div class='statusLabel'>Patient:</div> [patient.stat ? "<span class='bad'>Non-Responsive</span>" : "<span class='good'>Stable</span>"]<BR>
<div class='statusLabel'>Blood Type:</div> [patient.blood_type]
<div class='statusLabel'>Blood Type:</div> [patient.dna.blood_type]

<BR>
<div class='line'><div class='statusLabel'>Health:</div><div class='progressBar'><div style='width: [max(patient.health, 0)]%;' class='progressFill good'></div></div><div class='statusValue'>[patient.health]%</div></div>
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/cloning.dm
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@
if (subject.suiciding == 1)
scantemp = "<font class='bad'>Subject's brain is not responding to scanning stimuli.</font>"
return
if ((NOCLONE in subject.mutations) && (src.scanner.scan_level < 2))
if ((subject.disabilities & NOCLONE) && (src.scanner.scan_level < 2))
scantemp = "<font class='bad'>Subject no longer contains the fundamental materials required to create a living clone.</font>"
return
if ((!subject.ckey) || (!subject.client))
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/iv_drip.dm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
if(!istype(T)) return
if(!T.dna)
return
if(NOCLONE in T.mutations)
if(T.disabilities & NOCLONE)
return

if(NOBLOOD in T.dna.species.specflags)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/defib.dm
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@

var/failed = null

if (H.suiciding || (NOCLONE in H.mutations))
if (H.suiciding || (H.disabilities & NOCLONE))
failed = "<span class='warning'>[defib] buzzes: Resuscitation failed - Recovery of patient impossible. Further attempts futile.</span>"
else if ((tplus > tlimit) || !H.getorgan(/obj/item/organ/internal/heart))
failed = "<span class='warning'>[defib] buzzes: Resuscitation failed - Heart tissue damage beyond point of no return. Further attempts futile.</span>"
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/dna_injector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


/obj/item/weapon/dnainjector/proc/inject(mob/living/carbon/M, mob/user)
if(check_dna_integrity(M) && !(NOCLONE in M.mutations))
if(check_dna_integrity(M) && !(M.disabilities & NOCLONE))
if(M.stat == DEAD) //prevents dead people from having their DNA changed
user << "<span class='notice'>You can't modify [M]'s DNA while \he's dead.</span>"
return
Expand Down
8 changes: 4 additions & 4 deletions code/game/objects/structures/ai_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,20 @@
laws.clear_zeroth_law(0)
for(var/templaw in M.laws)
laws.add_inherent_law(templaw)
usr << "<span class='notice'>Law module applied.</span>"
user << "<span class='notice'>Law module applied.</span>"

if(istype(P, /obj/item/weapon/aiModule/reset/purge))
laws.clear_inherent_laws()
laws.clear_zeroth_law(0)
usr << "<span class='notice'>Laws cleared applied.</span>"
user << "<span class='notice'>Laws cleared applied.</span>"


if(istype(P, /obj/item/weapon/aiModule/supplied/freeform) || istype(P, /obj/item/weapon/aiModule/core/freeformcore))
var/obj/item/weapon/aiModule/supplied/freeform/M = P
if(M.laws[1] == "")
return
laws.add_inherent_law(M.laws[1])
usr << "<span class='notice'>Added a freeform law.</span>"
user << "<span class='notice'>Added a freeform law.</span>"

if(istype(P, /obj/item/device/mmi))
var/obj/item/device/mmi/M = P
Expand Down Expand Up @@ -166,7 +166,7 @@

M.loc = src
brain = M
usr << "<span class='notice'>Added a brain.</span>"
user << "<span class='notice'>Added a brain.</span>"
icon_state = "3b"

if(istype(P, /obj/item/weapon/crowbar) && brain)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/mirror.dm
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
hardset_dna(H, null, null, null, null, newrace)

if(H.dna.species.use_skintones)
var/new_s_tone = input(user, "What are we again?", "Race change") as null|anything in skin_tones
var/new_s_tone = input(user, "Choose your skin tone:", "Race change") as null|anything in skin_tones

if(new_s_tone)
H.skin_tone = new_s_tone
Expand Down
1 change: 0 additions & 1 deletion code/modules/admin/create_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
H.gender = pick(MALE, FEMALE)
H.real_name = random_unique_name(H.gender)
H.name = H.real_name
H.dna.generate_uni_identity(H)
H.underwear = random_underwear(H.gender)
H.skin_tone = random_skin_tone()
H.hair_style = random_hair_style(H.gender)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/secrets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
dat += "<table cellspacing=5><tr><th>Name</th><th>DNA</th><th>Blood Type</th></tr>"
for(var/mob/living/carbon/human/H in mob_list)
if(H.dna && H.ckey)
dat += "<tr><td>[H]</td><td>[H.dna.unique_enzymes]</td><td>[H.blood_type]</td></tr>"
dat += "<tr><td>[H]</td><td>[H.dna.unique_enzymes]</td><td>[H.dna.blood_type]</td></tr>"
dat += "</table>"
usr << browse(dat, "window=DNA;size=440x410")
if("fingerprints")
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/verbs/randomverbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
new_character.real_name = record_found.fields["name"]
new_character.gender = record_found.fields["sex"]
new_character.age = record_found.fields["age"]
new_character.blood_type = record_found.fields["blood_type"]
new_character.dna.blood_type = record_found.fields["blood_type"]
else
new_character.gender = pick(MALE,FEMALE)
var/datum/preferences/A = new()
Expand Down
Loading

0 comments on commit 73db851

Please sign in to comment.