From 182e11430dfeaa6db711ad86b10f8a3de04c9408 Mon Sep 17 00:00:00 2001 From: Razharas Date: Mon, 29 Jun 2015 14:21:06 +0300 Subject: [PATCH 1/2] Fixes chameleon mutation Fixes chameleon mutation --- code/datums/mutations.dm | 20 +++++++++++-------- .../mob/living/carbon/human/human_movement.dm | 3 +++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/code/datums/mutations.dm b/code/datums/mutations.dm index 9a17e523f9c..936590b0147 100644 --- a/code/datums/mutations.dm +++ b/code/datums/mutations.dm @@ -73,6 +73,9 @@ /datum/mutation/human/proc/on_ranged_attack(mob/living/carbon/human/owner, atom/target) return +/datum/mutation/human/proc/on_move(mob/living/carbon/human/owner, new_loc) + return + /datum/mutation/human/proc/on_life(mob/living/carbon/human/owner) return @@ -375,16 +378,17 @@ lowest_value = 256 * 14 text_gain_indication = "You feel one with your surroundings." text_lose_indication = "You feel oddly exposed." - var/last_location + +/datum/mutation/human/chameleon/on_acquiring(mob/living/carbon/human/owner) + if(..()) + return + owner.alpha = 204 //famous 255 * 0.8, yes its magic number, no i wont make it a define /datum/mutation/human/chameleon/on_life(mob/living/carbon/human/owner) - if(owner.loc != last_location) - owner.alpha = round(255 * 0.80) - last_location = owner.loc - if((world.time - owner.next_move) >= 30 && !owner.stat && owner.canmove && !owner.restrained()) - owner.alpha -= 25 - else - owner.alpha = round(255 * 0.80) + owner.alpha = max(0, owner.alpha - 25) + +/datum/mutation/human/chameleon/on_move(mob/living/carbon/human/owner) + owner.alpha = 204 //famous 255 * 0.8, yes its magic number, no i wont make it a define /datum/mutation/human/chameleon/on_losing(mob/living/carbon/human/owner) if(..()) diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index b9321879663..5dc30d5535a 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -46,6 +46,9 @@ /mob/living/carbon/human/Move(NewLoc, direct) ..() + if(dna) + for(var/datum/mutation/human/HM in dna.mutations) + HM.on_move(src, NewLoc) if(shoes) if(!lying) if(loc == NewLoc) From 38c2a54d9dabcf7244e1ff466294a65f11651578 Mon Sep 17 00:00:00 2001 From: Razharas Date: Sat, 4 Jul 2015 22:30:46 +0300 Subject: [PATCH 2/2] Replaces magic number with define Replaces magic number with define --- code/__DEFINES/genetics.dm | 2 ++ code/datums/mutations.dm | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/code/__DEFINES/genetics.dm b/code/__DEFINES/genetics.dm index f60dddd0758..86ecb31fc79 100644 --- a/code/__DEFINES/genetics.dm +++ b/code/__DEFINES/genetics.dm @@ -25,6 +25,8 @@ #define CHAV "Chav" #define ELVIS "Elvis" +#define CHAMELEON_MUTATION_DEFAULT_TRANSPARENCY 204 + // String identifiers for associative list lookup //Types of usual mutations diff --git a/code/datums/mutations.dm b/code/datums/mutations.dm index 936590b0147..c47f4771b77 100644 --- a/code/datums/mutations.dm +++ b/code/datums/mutations.dm @@ -382,13 +382,13 @@ /datum/mutation/human/chameleon/on_acquiring(mob/living/carbon/human/owner) if(..()) return - owner.alpha = 204 //famous 255 * 0.8, yes its magic number, no i wont make it a define + owner.alpha = CHAMELEON_MUTATION_DEFAULT_TRANSPARENCY /datum/mutation/human/chameleon/on_life(mob/living/carbon/human/owner) owner.alpha = max(0, owner.alpha - 25) /datum/mutation/human/chameleon/on_move(mob/living/carbon/human/owner) - owner.alpha = 204 //famous 255 * 0.8, yes its magic number, no i wont make it a define + owner.alpha = CHAMELEON_MUTATION_DEFAULT_TRANSPARENCY /datum/mutation/human/chameleon/on_losing(mob/living/carbon/human/owner) if(..())