diff --git a/devNotes/eye functions.md b/devNotes/eye functions.md new file mode 100644 index 0000000000000000000000000000000000000000..e1bdb1a49e240fd267cc3749277d67c1979cb098 --- /dev/null +++ b/devNotes/eye functions.md @@ -0,0 +1,133 @@ +## Eye Functions + +In all functions `side` can be `left`, `right` or `both` unless stated otherwise. + +Eye types: `1`: normal; `2`: glass; `3`: cybernetic +`0` is used as return value if there is no eye, but is never stored in the slave object. + +Vision: `0`: blind; `1`: nearsighted (or impaired/blurred); `2`: normal + +### Read-only functions + +* `hasAnyEyes(slave)`: + True if slave has at least one eye. + +* `hasAnyNaturalEyes(slave)`: + True if slave has at least one eye that is natural. + +* `hasAnyProstheticEyes(slave)`: + True if slave has at least one eye that is prosthetic (cybernetic or glass). + +* `hasAnyCyberneticEyes(slave)`: + True if slave has at least one eye that is cybernetic. + +* `hasBothEyes(slave)`: + True if slave has both eyes. + +* `hasBothNaturalEyes(slave)`: + True if slave has both eyes and they are natural. + +* `hasBothProstheticEyes(slave)`: + True if slave has both eyes and they are prosthetic (cybernetic or glass). + +* `hasBothCyberneticEyes(slave)`: + True if slave has both eyes and they are cybernetic. + +* `hasLeftEye(slave)`: + True if slave has left eye. + +* `hasRightEye(slave)`: + True if slave has right eye. + +* `getLeftEyeType(slave)`: + Returns type of the left eye. + +* `getRightEyeType(slave)`: + Returns type of the right eye. + +* `getLeftEyeVision(slave)`: + Returns vision of the left eye. + +* `getRightEyeVision(slave)`: + Returns vision of the right eye. + +* `getBestVision(slave)`: + Returns highest vision of both eyes. + +* `getWorstVision(slave)`: + Returns lowest vision of both eyes. + +* `anyVisionEquals(slave, vision)`: + True if one eye has the specified vision. + +* `getLeftEyeColor(slave)`: + Returns color of the left eye. If there is no eye `empty` is returned. + +* `getRightEyeColor(slave)`: + Returns color of the right eye. If there is no eye `empty` is returned. + +* `getLeftEyePupil(slave)`: + Returns the shape of pupil of the left eye. If there is no eye `circular` is returned. + +* `getRightEyePupil(slave)`: + Returns the shape of pupil of the right eye. If there is no eye `circular` is returned. + +* `hasVisibleHeterochromia(slave)`: + True if left and right eye colors are different. Does NOT relate to the genetic quirk. + +* `getGeneticEyeColor(slave, side)`: + Gives the genetic color of the specified eye. + `both` is not allowed as value of `side`. + +* `getLenseCount(slave)`: + Counts the number of eyes that are not the genetic color. + + +### Description + +* `App.Desc.eyesType(slave)`: + Fits in a sentence like this: She has {return}. + +* `App.Desc.eyeTypeToString(type)`: + Converts an eye type to a string. + `1` -> `natural` + `2` -> `glass` + `3` -> `artificial` + +* `App.Desc.eyesColor(slave, adj = "", eye = "eye", eyes = "eyes")`: + Fits in a sentence like this: She has {return}. + `adj` is added in between color and eye like this: `brown wet eyes`. + +* `App.Desc.eyeColor(slave)`: + Fits in a sentence like this: She has {return} eyes. + Prefer App.Desc.eyesColor if possible as it works reliably with only one eye. Example where this is better: {return}-eyed gaze + +* `App.Desc.eyesVision(slave)`: + Fits in a sentence like this: She has {return}. + +* `App.Desc.eyesToVision(slave)`: + Converts an eye vision to a string. + `0` -> `blind` + `1` -> `nearsighted` + `2` -> `normal` + + +### Modification + +* `eyeSurgery(slave, side, action)`: + Modifies a slaves eyes. + Allowed values for `action`: + No Existing eyes required: `normal`, `glass`, `cybernetic` + Existing eyes required: `remove`, `blind`, `blur`, `fix` + +* `setEyeColor(slave, color, side = "both")`: + Changes the visible eye color. + +* `setEyeColorFull(slave, iris, pupil, sclera, side)`: + Changes all visible parts of the eye. + +* `setGeneticEyeColor(slave, color, heterochromia = false)`: + Changes the genetic eye color. WARNING: If `heterochromia` is `true`, the function will add the genetic quirk, even if the slave did not have it before. + +* `resetEyeColor(slave, side)`: + Sets the eye color to the genetic color. Takes heterochromia and albinism into account. \ No newline at end of file diff --git a/src/js/statsChecker/eyeChecker.js b/src/js/statsChecker/eyeChecker.js index a66077a004564d73e4884ad994db15ae15c44ff3..058e3c1016904d72a7900d94480c5603734035b7 100644 --- a/src/js/statsChecker/eyeChecker.js +++ b/src/js/statsChecker/eyeChecker.js @@ -98,7 +98,7 @@ window.hasRightEye = function(slave) { }; /** - * Returns type of the left eye. Uses new IDs. + * Returns type of the left eye. * * @param {App.Entity.SlaveState} slave * @returns {number} @@ -112,7 +112,7 @@ window.getLeftEyeType = function(slave) { }; /** - * Returns type of the right eye. Uses new IDs. + * Returns type of the right eye. * * @param {App.Entity.SlaveState} slave * @returns {number} diff --git a/src/js/surgery.js b/src/js/surgery.js index 5ab49f55679f6470566ed67840029560921b52b9..27a6159e36926dbd70f283e03e343bf9c58e30d9 100644 --- a/src/js/surgery.js +++ b/src/js/surgery.js @@ -644,7 +644,7 @@ window.setGeneticEyeColor = function(slave, color, heterochromia = false) { /** * Sets the eye color to the genetic color. - * Takes heterochroma and albinism into account. + * Takes heterochromia and albinism into account. * * @param {App.Entity.SlaveState} slave * @param {string} side diff --git a/src/npc/descriptions/eyes.js b/src/npc/descriptions/eyes.js index d9816939a2f76c9b29ea90ff26e160ebd6fb361c..564f0f08def476ac990a7962b24faa9252ebcddb 100644 --- a/src/npc/descriptions/eyes.js +++ b/src/npc/descriptions/eyes.js @@ -141,9 +141,9 @@ App.Desc.eyeVisionToString = function(type) { switch (type) { case 0: return "blind"; - case 2: + case 1: return "nearsighted"; - case 3: + case 2: return "normal"; default: return "unknown eye vision: " + type;