Make Custom Ears And Tails Persist Across Cloning

* Adds ears, tails, tail color, and micro/macro to dna so it will be persisted when scanned and cloned.
This commit is contained in:
Leshana
2016-05-30 20:07:17 -04:00
parent 6283dcdc86
commit 0f30f01ad2
2 changed files with 69 additions and 3 deletions
+40 -3
View File
@@ -33,7 +33,13 @@
#define DNA_UI_GENDER 14
#define DNA_UI_BEARD_STYLE 15
#define DNA_UI_HAIR_STYLE 16
#define DNA_UI_LENGTH 16 // Update this when you add something, or you WILL break shit.
#define DNA_UI_EAR_STYLE 17
#define DNA_UI_TAIL_STYLE 18
#define DNA_UI_PLAYERSCALE 19
#define DNA_UI_TAIL_R 20
#define DNA_UI_TAIL_G 21
#define DNA_UI_TAIL_B 22
#define DNA_UI_LENGTH 22 // Update this when you add something, or you WILL break shit.
#define DNA_SE_LENGTH 27
// For later:
@@ -129,6 +135,37 @@ var/global/list/datum/dna/gene/dna_genes[0]
character.f_style = "Shaved"
var/beard = facial_hair_styles_list.Find(character.f_style)
// VOREStation Edit Start
// Demi Ears
var/ear_style = 0
if(character.ear_style)
ear_style = ear_styles_list.Find(character.ear_style.type)
// Demi Tails
var/tail_style = 0
if(character.tail_style)
tail_style = tail_styles_list.Find(character.tail_style.type)
// Playerscale (This assumes list is sorted big->small)
var/size_multiplier = player_sizes_list.len // If fail to find, take smallest
for(var/N in player_sizes_list)
if(character.size_multiplier >= player_sizes_list[N])
size_multiplier = player_sizes_list.Find(N)
break
// +1 to account for the none-of-the-above possibility
SetUIValueRange(DNA_UI_EAR_STYLE, ear_style + 1, ear_styles_list.len + 1, 1)
SetUIValueRange(DNA_UI_TAIL_STYLE, tail_style + 1, tail_styles_list.len + 1, 1)
SetUIValueRange(DNA_UI_PLAYERSCALE, size_multiplier, player_sizes_list.len, 1)
SetUIValueRange(DNA_UI_TAIL_R, character.r_tail, 255, 1)
SetUIValueRange(DNA_UI_TAIL_G, character.g_tail, 255, 1)
SetUIValueRange(DNA_UI_TAIL_B, character.b_tail, 255, 1)
// VORE Station Edit End
SetUIValueRange(DNA_UI_HAIR_R, character.r_hair, 255, 1)
SetUIValueRange(DNA_UI_HAIR_G, character.g_hair, 255, 1)
SetUIValueRange(DNA_UI_HAIR_B, character.b_hair, 255, 1)
@@ -183,7 +220,7 @@ var/global/list/datum/dna/gene/dna_genes[0]
/datum/dna/proc/GetUIValueRange(var/block,var/maxvalue)
if (block<=0) return 0
var/value = GetUIValue(block)
return round(1 +(value / 4096)*maxvalue)
return round(0.5 + (value / 4096) * maxvalue)
// Is the UI gene "on" or "off"?
// For UI, this is simply a check of if the value is > 2050.
@@ -322,7 +359,7 @@ var/global/list/datum/dna/gene/dna_genes[0]
/proc/EncodeDNABlock(var/value)
return add_zero2(num2hex(value,1), 3)
return num2hex(value, 3)
/datum/dna/proc/UpdateUI()
src.uni_identity=""
+29
View File
@@ -166,7 +166,36 @@
if((0 < beard) && (beard <= facial_hair_styles_list.len))
H.f_style = facial_hair_styles_list[beard]
// VORE StationEdit Start
//Ears
var/ears = dna.GetUIValueRange(DNA_UI_EAR_STYLE, ear_styles_list.len + 1) - 1
if(ears <= 1)
H.ear_style = null
else if((0 < ears) && (ears <= ear_styles_list.len))
H.ear_style = ear_styles_list[ear_styles_list[ears]]
//Tail
var/tail = dna.GetUIValueRange(DNA_UI_TAIL_STYLE, tail_styles_list.len + 1) - 1
if(tail <= 1)
H.tail_style = null
else if((0 < tail) && (tail <= tail_styles_list.len))
H.tail_style = tail_styles_list[tail_styles_list[tail]]
// Playerscale
var/size = dna.GetUIValueRange(DNA_UI_PLAYERSCALE, player_sizes_list.len)
if((0 < size) && (size <= player_sizes_list.len))
H.size_multiplier = player_sizes_list[player_sizes_list[size]]
// Tail/Taur Color
H.r_tail = dna.GetUIValueRange(DNA_UI_TAIL_R, 255)
H.g_tail = dna.GetUIValueRange(DNA_UI_TAIL_G, 255)
H.b_tail = dna.GetUIValueRange(DNA_UI_TAIL_B, 255)
// VOREStation Edit End
H.force_update_limbs()
H.update_body(0)
H.update_eyes()
H.update_hair()