Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors species-based offsets, condenses all offsets into a single list, adds support for all other standing icons #31642

Merged
merged 13 commits into from Oct 15, 2017

Conversation

Militaires
Copy link

this means you can offset every individual shoe, hat, ID, uniform and whatever.

@tgstation-server tgstation-server added the Refactor Makes the code harder to read label Oct 12, 2017
if("face" in H.dna.species.offset_features)
var/list/offset_list = H.dna.species.offset_features["face"]
hair_overlay.pixel_x += offset_list[1]
hair_overlay.pixel_y += offset_list[2]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for another list in any of these, just do
hair_overlay.pixel_y += H.dna.species.offset_features["face"][2]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@Iamgoofball
Copy link
Contributor

👍 will help with dwarves

@@ -18,8 +18,7 @@

var/sexes = 1 // whether or not the race has sexual characteristics. at the moment this is only 0 for skeletons and shadows

var/face_y_offset = 0
var/hair_y_offset = 0
var/offset_features = list("uniform" = list(0,0), "id" = list(0,0), "gloves" = list(0,0), "glasses" = list(0,0), "ears" = list(0,0), "shoes" = list(0,0), "s_store" = list(0,0), "mask" = list(0,0), "head" = list(0,0),"face" = list(0,0), "belt" = list(0,0), "back" = list(0,0), "suit" = list(0,0), "neck" = list(0,0))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use magic strings.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does that mean i should add it to the species on init or what

@@ -125,6 +125,13 @@
if(wear_mask)
if(!(head && (head.flags_inv & HIDEMASK)))
overlays_standing[FACEMASK_LAYER] = wear_mask.build_worn_icon(state = wear_mask.icon_state, default_layer = FACEMASK_LAYER, default_icon_file = 'icons/mob/mask.dmi')
if(ishuman(src))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. If it's human functionality you do it on human level.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure thing boss

#define OFFSET_BELT "belt"
#define OFFSET_BACK "back"
#define OFFSET_SUIT "suit"
#define OFFSET_NECK "neck"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These need to be under the __DEFINES directory

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if they're only used in this file he can leave them here and then #undef them at the end of the file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're not only used here, they're also used in update_icons.dm

hair_overlay.pixel_y += hair_y_offset
if("face" in H.dna.species.offset_features)
hair_overlay.pixel_x += H.dna.species.offset_features["face"][1]
hair_overlay.pixel_y += H.dna.species.offset_features["face"][2]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making the defines isn't enough, you have to actualy use the things.

lip_overlay.pixel_y += face_y_offset
if("face" in H.dna.species.offset_features)
lip_overlay.pixel_x += H.dna.species.offset_features["face"][1]
lip_overlay.pixel_y += H.dna.species.offset_features["face"][2]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

eye_overlay.pixel_y += face_y_offset
if("face" in H.dna.species.offset_features)
eye_overlay.pixel_x += H.dna.species.offset_features["face"][1]
eye_overlay.pixel_y += H.dna.species.offset_features["face"][2]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here


if("uniform" in dna.species.offset_features)
uniform_overlay.pixel_x += dna.species.offset_features["uniform"][1]
uniform_overlay.pixel_y += dna.species.offset_features["uniform"][2]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

remove_overlay(HEAD_LAYER)
if("head" in dna.species.offset_features)
head_overlay.pixel_x += dna.species.offset_features["head"][1]
head_overlay.pixel_y += dna.species.offset_features["head"][2]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

var/mutable_appearance/belt_overlay = overlays_standing[BELT_LAYER]
if("belt" in dna.species.offset_features)
belt_overlay.pixel_x += dna.species.offset_features["belt"][1]
belt_overlay.pixel_y += dna.species.offset_features["belt"][2]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

var/mutable_appearance/suit_overlay = overlays_standing[SUIT_LAYER]
if("suit" in dna.species.offset_features)
suit_overlay.pixel_x += dna.species.offset_features["suit"][1]
suit_overlay.pixel_y += dna.species.offset_features["suit"][2]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

remove_overlay(FACEMASK_LAYER)
if("mask" in dna.species.offset_features)
mask_overlay.pixel_x += dna.species.offset_features["mask"][1]
mask_overlay.pixel_y += dna.species.offset_features["mask"][2]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

remove_overlay(BACK_LAYER)
if("back" in dna.species.offset_features)
back_overlay.pixel_x += dna.species.offset_features["back"][1]
back_overlay.pixel_y += dna.species.offset_features["back"][2]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@@ -124,7 +124,7 @@ There are several things that need to be remembered:
else if(U.adjusted == DIGITIGRADE_STYLE)
t_color = "[t_color]_l"

var/mutable_appearance/uniform_overlay
var/mutable_appearance/uniform_overlay = overlays_standing[UNIFORM_LAYER]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You changed the default here so the uniform won't update for species without gender variants.

@@ -18,8 +17,7 @@

var/sexes = 1 // whether or not the race has sexual characteristics. at the moment this is only 0 for skeletons and shadows

var/face_y_offset = 0
var/hair_y_offset = 0
var/offset_features = list(OFFSET_UNIFORM = list(0,0), OFFSET_ID = list(0,0), OFFSET_GLOVES = list(0,0), OFFSET_GLASSES = list(0,0), OFFSET_EARS = list(0,0), OFFSET_SHOES = list(0,0), OFFSET_S_STORE = list(0,0), OFFSET_FACEMASK = list(0,0), OFFSET_HEAD = list(0,0), OFFSET_FACE = list(0,0), OFFSET_BELT = list(0,0), OFFSET_BACK = list(0,0), OFFSET_SUIT = list(0,0), OFFSET_NECK = list(0,0))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var/list/offset_features = ...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how embarrassing

@@ -351,8 +399,24 @@ There are several things that need to be remembered:

/mob/living/carbon/human/update_inv_wear_mask()
..()
var/mutable_appearance/mask_overlay = overlays_standing[FACEMASK_LAYER]
remove_overlay(FACEMASK_LAYER)
if(OFFSET_FACEMASK in dna.species.offset_features)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to check if overlay actually exists here in and in the one below

@AnturK AnturK merged commit 068f91e into tgstation:master Oct 15, 2017
ghost referenced this pull request in HippieStation/HippieStationdeprecated2020 Oct 15, 2017
… list, adds support for all other standing icons (#31642)

* Fixes shambrero penguin's name

* Revert "Fixes shambrero penguin's name"

This reverts commit 59376543da685167c14eb683342bda2edb8b8eeb.

* Refactors species-based offsets, condenses all offsets into a single list, adds support for all other drawn human icons

* de commit go SKKKRRAAH

* I ZOI EN TAFO

* STOP magic

* take my twix by force

* uniform_overlay = ''' >>> uniform_overlay

* var/x >>> var/list/x

* if(overlay) sanity checks in place

* if(DEFINE) >>>>>>>> if(overlay)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactor Makes the code harder to read
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants