From b1940f30df8491e7fffab24a10800ededef85a8a Mon Sep 17 00:00:00 2001 From: zongor Date: Sun, 30 Jun 2024 21:12:58 -0400 Subject: [PATCH] update schema --- server/components/DerivedStats.js | 66 ++- server/components/Entity.js | 63 ++- server/components/Item.js | 37 +- server/components/Phenomenon.js | 31 +- server/components/Skills.js | 114 ++++- server/components/Stats.js | 48 +- server/components/Vector3.js | 36 +- server/schema.json | 413 +++++++++--------- .../test/schema.json | 5 + 9 files changed, 547 insertions(+), 266 deletions(-) diff --git a/server/components/DerivedStats.js b/server/components/DerivedStats.js index 1a2a5c1..451829c 100644 --- a/server/components/DerivedStats.js +++ b/server/components/DerivedStats.js @@ -1,89 +1,137 @@ +/** + * @typedef {Object} DerivedStats Derived user stats + * @property {Uint8} u8 how many hits you can take, if it reaches 0 you ded! + * @property {Uint8} u8 How many strenuous actions you can take, i.e. swinging a hammer, attacking, fishing, etc. + * @property {Uint8} u8 being able to observe some objects + * @property {Uint8} u8 Get better probability rolls for things that matter for rolls + * @property {Uint8} u8 Probability of being discovered when hiding + * @property {Uint8} u8 based on your character you make in the creator. more attractive will have better outcomes with aristocracy and more 'ugly' will have better outcomes with working class. + * @property {Uint8} u8 same as attractiveness but can change with money + * @property {Int8} i8 how attuned to the vision of Eru + */ class DerivedStats { /** * how many hits you can take, if it reaches 0 you ded! + * @return {Uint8} gets the value of Hitpoints */ get Hitpoints() { return this._data.getUint8(0, true); } + /** + * how many hits you can take, if it reaches 0 you ded! + * @param {Uint8} sets the value of Hitpoints + */ set Hitpoints(v) { return this._data.setUint8(0, v, true); } /** * How many strenuous actions you can take, i.e. swinging a hammer, attacking, fishing, etc. + * @return {Uint8} gets the value of Stamina */ get Stamina() { return this._data.getUint8(1, true); } + /** + * How many strenuous actions you can take, i.e. swinging a hammer, attacking, fishing, etc. + * @param {Uint8} sets the value of Stamina + */ set Stamina(v) { return this._data.setUint8(1, v, true); } /** * being able to observe some objects + * @return {Uint8} gets the value of Perception */ get Perception() { return this._data.getUint8(2, true); } + /** + * being able to observe some objects + * @param {Uint8} sets the value of Perception + */ set Perception(v) { return this._data.setUint8(2, v, true); } /** * Get better probability rolls for things that matter for rolls + * @return {Uint8} gets the value of Luck */ get Luck() { return this._data.getUint8(3, true); } + /** + * Get better probability rolls for things that matter for rolls + * @param {Uint8} sets the value of Luck + */ set Luck(v) { return this._data.setUint8(3, v, true); } /** * Probability of being discovered when hiding + * @return {Uint8} gets the value of Stealth */ get Stealth() { return this._data.getUint8(4, true); } + /** + * Probability of being discovered when hiding + * @param {Uint8} sets the value of Stealth + */ set Stealth(v) { return this._data.setUint8(4, v, true); } /** * based on your character you make in the creator. more attractive will have better outcomes with aristocracy and more 'ugly' will have better outcomes with working class. + * @return {Uint8} gets the value of Attractiveness */ get Attractiveness() { return this._data.getUint8(5, true); } + /** + * based on your character you make in the creator. more attractive will have better outcomes with aristocracy and more 'ugly' will have better outcomes with working class. + * @param {Uint8} sets the value of Attractiveness + */ set Attractiveness(v) { return this._data.setUint8(5, v, true); } /** * same as attractiveness but can change with money + * @return {Uint8} gets the value of Affluence */ get Affluence() { return this._data.getUint8(6, true); } + /** + * same as attractiveness but can change with money + * @param {Uint8} sets the value of Affluence + */ set Affluence(v) { return this._data.setUint8(6, v, true); } /** * how attuned to the vision of Eru + * @return {Int8} gets the value of Holyness */ get Holyness() { return this._data.getInt8(7, true); } + /** + * how attuned to the vision of Eru + * @param {Int8} sets the value of Holyness + */ set Holyness(v) { return this._data.setInt8(7, v, true); } - /** - * get the struct representation of the object - */ - get bytes() { - return new Uint8Array(this._ptr); - } /** - * constructor + * Constructs a new DerivedStats + * + * @param {{Hitpoints: Uint8, Stamina: Uint8, Perception: Uint8, Luck: Uint8, Stealth: Uint8, Attractiveness: Uint8, Affluence: Uint8, Holyness: Int8, }} init The arguments to construct the object. + * @param {Uint8Array} ptr The pointer to the C struct. */ constructor(init = {}, ptr = undefined) { this._size = 8; - this._ptr = ptr.buffer || new ArrayBuffer(this._size); - this._data = new DataView(this._ptr); + this._ptr = ptr || new Uint8Array(this._size); + this._data = new DataView(this._ptr.buffer); for (const key of Object.keys(init)) { this[key] = init[key]; diff --git a/server/components/Entity.js b/server/components/Entity.js index ecc3e91..b043573 100644 --- a/server/components/Entity.js +++ b/server/components/Entity.js @@ -2,65 +2,100 @@ import Vector3 from "./Vector3" import Stats from "./Stats" import DerivedStats from "./DerivedStats" import Skills from "./Skills" +/** + * @typedef {Object} Entity Something that can exist in 3D space + * @property {string} Name Name of the entity + * @property {Vector3} Vector3 Vector3 of the entity in space + * @property {Stats} Stats Base stats + * @property {DerivedStats} DerivedStats Stats that are derived from skills and base stats + * @property {Skills} Skills Stuff that your character can do + */ class Entity { /** * Name of the entity + * @return {string} gets the value of Name */ get Name() { return this._decoder.decode(new Uint8Array(this._ptr.slice(0, 24))); } + /** + * Name of the entity + * @param {string} v sets the value of Name + */ set Name(v) { - this._data.set(this._encoder.encode(v), 0); + if (v.length > 24) { + throw new Error("input is larger than buffer size of 24"); + } + const tmp = new Uint8Array(new ArrayBuffer(24)); + tmp.set(this._encoder.encode(v)) + this._ptr.set(tmp.buffer, 0); } /** * Vector3 of the entity in space + * @return {Vector3} gets the value of Vector3 */ get Vector3() { return new Vector3({}, new Uint8Array(this._ptr.slice(24, 36))); } + /** + * Vector3 of the entity in space + * @param {Vector3} sets the value of Vector3 + */ set Vector3(v) { - this._data.set(v.bytes(), 24); + this._ptr.set(v._ptr, 24); } /** * Base stats + * @return {Stats} gets the value of Stats */ get Stats() { return new Stats({}, new Uint8Array(this._ptr.slice(36, 41))); } + /** + * Base stats + * @param {Stats} sets the value of Stats + */ set Stats(v) { - this._data.set(v.bytes(), 36); + this._ptr.set(v._ptr, 36); } /** * Stats that are derived from skills and base stats + * @return {DerivedStats} gets the value of DerivedStats */ get DerivedStats() { return new DerivedStats({}, new Uint8Array(this._ptr.slice(41, 49))); } + /** + * Stats that are derived from skills and base stats + * @param {DerivedStats} sets the value of DerivedStats + */ set DerivedStats(v) { - this._data.set(v.bytes(), 41); + this._ptr.set(v._ptr, 41); } /** * Stuff that your character can do + * @return {Skills} gets the value of Skills */ get Skills() { return new Skills({}, new Uint8Array(this._ptr.slice(49, 65))); } - set Skills(v) { - this._data.set(v.bytes(), 49); - } - /** - * get the struct representation of the object + /** + * Stuff that your character can do + * @param {Skills} sets the value of Skills */ - get bytes() { - return new Uint8Array(this._ptr); + set Skills(v) { + this._ptr.set(v._ptr, 49); } /** - * constructor + * Constructs a new Entity + * + * @param {{Name: string, Vector3: Vector3, Stats: Stats, DerivedStats: DerivedStats, Skills: Skills, }} init The arguments to construct the object. + * @param {Uint8Array} ptr The pointer to the C struct. */ constructor(init = {}, ptr = undefined) { this._size = 65; - this._ptr = ptr.buffer || new ArrayBuffer(this._size); - this._data = new DataView(this._ptr); + this._ptr = ptr || new Uint8Array(this._size); + this._data = new DataView(this._ptr.buffer); this._encoder = new TextEncoder(); this._decoder = new TextDecoder(); diff --git a/server/components/Item.js b/server/components/Item.js index 68a85cf..86c1648 100644 --- a/server/components/Item.js +++ b/server/components/Item.js @@ -1,35 +1,52 @@ +/** + * @typedef {Object} Item Item + * @property {string} Name Name of the item + * @property {Int32} i32 Default starting value of the item + */ class Item { /** * Name of the item + * @return {string} gets the value of Name */ get Name() { return this._decoder.decode(new Uint8Array(this._ptr.slice(0, 24))); } + /** + * Name of the item + * @param {string} v sets the value of Name + */ set Name(v) { - this._data.set(this._encoder.encode(v), 0); + if (v.length > 24) { + throw new Error("input is larger than buffer size of 24"); + } + const tmp = new Uint8Array(new ArrayBuffer(24)); + tmp.set(this._encoder.encode(v)) + this._ptr.set(tmp.buffer, 0); } /** * Default starting value of the item + * @return {Int32} gets the value of BaseValue */ get BaseValue() { return this._data.getInt32(24, true); } + /** + * Default starting value of the item + * @param {Int32} sets the value of BaseValue + */ set BaseValue(v) { return this._data.setInt32(24, v, true); } - /** - * get the struct representation of the object - */ - get bytes() { - return new Uint8Array(this._ptr); - } /** - * constructor + * Constructs a new Item + * + * @param {{Name: string, BaseValue: Int32, }} init The arguments to construct the object. + * @param {Uint8Array} ptr The pointer to the C struct. */ constructor(init = {}, ptr = undefined) { this._size = 28; - this._ptr = ptr.buffer || new ArrayBuffer(this._size); - this._data = new DataView(this._ptr); + this._ptr = ptr || new Uint8Array(this._size); + this._data = new DataView(this._ptr.buffer); this._encoder = new TextEncoder(); this._decoder = new TextDecoder(); diff --git a/server/components/Phenomenon.js b/server/components/Phenomenon.js index 661861b..964e875 100644 --- a/server/components/Phenomenon.js +++ b/server/components/Phenomenon.js @@ -1,26 +1,37 @@ +/** + * @typedef {Object} Phenomenon Kinda like an action, cant remember + * @property {string} Name Name of the phenomenon + */ class Phenomenon { /** * Name of the phenomenon + * @return {string} gets the value of Name */ get Name() { return this._decoder.decode(new Uint8Array(this._ptr.slice(0, 64))); } + /** + * Name of the phenomenon + * @param {string} v sets the value of Name + */ set Name(v) { - this._data.set(this._encoder.encode(v), 0); - } - /** - * get the struct representation of the object - */ - get bytes() { - return new Uint8Array(this._ptr); + if (v.length > 64) { + throw new Error("input is larger than buffer size of 64"); + } + const tmp = new Uint8Array(new ArrayBuffer(64)); + tmp.set(this._encoder.encode(v)) + this._ptr.set(tmp.buffer, 0); } /** - * constructor + * Constructs a new Phenomenon + * + * @param {{Name: string, }} init The arguments to construct the object. + * @param {Uint8Array} ptr The pointer to the C struct. */ constructor(init = {}, ptr = undefined) { this._size = 64; - this._ptr = ptr.buffer || new ArrayBuffer(this._size); - this._data = new DataView(this._ptr); + this._ptr = ptr || new Uint8Array(this._size); + this._data = new DataView(this._ptr.buffer); this._encoder = new TextEncoder(); this._decoder = new TextDecoder(); diff --git a/server/components/Skills.js b/server/components/Skills.js index b19f86d..2412030 100644 --- a/server/components/Skills.js +++ b/server/components/Skills.js @@ -1,161 +1,257 @@ +/** + * @typedef {Object} Skills User skills + * @property {Uint8} u8 Crafting, visual arts, etc. + * @property {Uint8} u8 cooking, baking, brewing, + * @property {Uint8} u8 using guns/cannons, bows, etc. + * @property {Uint8} u8 using swords, hammers, pole-arms etc. + * @property {Uint8} u8 being able to contort, move, dodge, etc. + * @property {Uint8} u8 skullduggery, lock-picking, deceiving, slight of hand + * @property {Uint8} u8 creating and using contraptions, building houses + * @property {Uint8} u8 obvious, but in this you can also use automatic stuff + * @property {Uint8} u8 ability to read/write a specific language + * @property {Uint8} u8 healing hp, getting rid of diseases, etc. + * @property {Uint8} u8 Creating potions, creating alloys, creating chemicals, component based 'magic' + * @property {Uint8} u8 collecting fish + * @property {Uint8} u8 collecting ore + * @property {Uint8} u8 woodcutting, fire-making, hunting, collecting herbs, etc. + * @property {Uint8} u8 growing plants, herbs, etc. + * @property {Uint8} u8 will give more information when examining some objects + */ class Skills { /** * Crafting, visual arts, etc. + * @return {Uint8} gets the value of Artisan */ get Artisan() { return this._data.getUint8(0, true); } + /** + * Crafting, visual arts, etc. + * @param {Uint8} sets the value of Artisan + */ set Artisan(v) { return this._data.setUint8(0, v, true); } /** * cooking, baking, brewing, + * @return {Uint8} gets the value of Culinary */ get Culinary() { return this._data.getUint8(1, true); } + /** + * cooking, baking, brewing, + * @param {Uint8} sets the value of Culinary + */ set Culinary(v) { return this._data.setUint8(1, v, true); } /** * using guns/cannons, bows, etc. + * @return {Uint8} gets the value of Ranged */ get Ranged() { return this._data.getUint8(2, true); } + /** + * using guns/cannons, bows, etc. + * @param {Uint8} sets the value of Ranged + */ set Ranged(v) { return this._data.setUint8(2, v, true); } /** * using swords, hammers, pole-arms etc. + * @return {Uint8} gets the value of Melee */ get Melee() { return this._data.getUint8(3, true); } + /** + * using swords, hammers, pole-arms etc. + * @param {Uint8} sets the value of Melee + */ set Melee(v) { return this._data.setUint8(3, v, true); } /** * being able to contort, move, dodge, etc. + * @return {Uint8} gets the value of Acrobatics */ get Acrobatics() { return this._data.getUint8(4, true); } + /** + * being able to contort, move, dodge, etc. + * @param {Uint8} sets the value of Acrobatics + */ set Acrobatics(v) { return this._data.setUint8(4, v, true); } /** * skullduggery, lock-picking, deceiving, slight of hand + * @return {Uint8} gets the value of Prestidigitation */ get Prestidigitation() { return this._data.getUint8(5, true); } + /** + * skullduggery, lock-picking, deceiving, slight of hand + * @param {Uint8} sets the value of Prestidigitation + */ set Prestidigitation(v) { return this._data.setUint8(5, v, true); } /** * creating and using contraptions, building houses + * @return {Uint8} gets the value of Engineering */ get Engineering() { return this._data.getUint8(6, true); } + /** + * creating and using contraptions, building houses + * @param {Uint8} sets the value of Engineering + */ set Engineering(v) { return this._data.setUint8(6, v, true); } /** * obvious, but in this you can also use automatic stuff + * @return {Uint8} gets the value of Metalworking */ get Metalworking() { return this._data.getUint8(7, true); } + /** + * obvious, but in this you can also use automatic stuff + * @param {Uint8} sets the value of Metalworking + */ set Metalworking(v) { return this._data.setUint8(7, v, true); } /** * ability to read/write a specific language + * @return {Uint8} gets the value of Language */ get Language() { return this._data.getUint8(8, true); } + /** + * ability to read/write a specific language + * @param {Uint8} sets the value of Language + */ set Language(v) { return this._data.setUint8(8, v, true); } /** * healing hp, getting rid of diseases, etc. + * @return {Uint8} gets the value of Medicine */ get Medicine() { return this._data.getUint8(9, true); } + /** + * healing hp, getting rid of diseases, etc. + * @param {Uint8} sets the value of Medicine + */ set Medicine(v) { return this._data.setUint8(9, v, true); } /** * Creating potions, creating alloys, creating chemicals, component based 'magic' + * @return {Uint8} gets the value of Alchemy */ get Alchemy() { return this._data.getUint8(10, true); } + /** + * Creating potions, creating alloys, creating chemicals, component based 'magic' + * @param {Uint8} sets the value of Alchemy + */ set Alchemy(v) { return this._data.setUint8(10, v, true); } /** * collecting fish + * @return {Uint8} gets the value of Fishing */ get Fishing() { return this._data.getUint8(11, true); } + /** + * collecting fish + * @param {Uint8} sets the value of Fishing + */ set Fishing(v) { return this._data.setUint8(11, v, true); } /** * collecting ore + * @return {Uint8} gets the value of Mining */ get Mining() { return this._data.getUint8(12, true); } + /** + * collecting ore + * @param {Uint8} sets the value of Mining + */ set Mining(v) { return this._data.setUint8(12, v, true); } /** * woodcutting, fire-making, hunting, collecting herbs, etc. + * @return {Uint8} gets the value of Survival */ get Survival() { return this._data.getUint8(13, true); } + /** + * woodcutting, fire-making, hunting, collecting herbs, etc. + * @param {Uint8} sets the value of Survival + */ set Survival(v) { return this._data.setUint8(13, v, true); } /** * growing plants, herbs, etc. + * @return {Uint8} gets the value of Gardening */ get Gardening() { return this._data.getUint8(14, true); } + /** + * growing plants, herbs, etc. + * @param {Uint8} sets the value of Gardening + */ set Gardening(v) { return this._data.setUint8(14, v, true); } /** * will give more information when examining some objects + * @return {Uint8} gets the value of History */ get History() { return this._data.getUint8(15, true); } + /** + * will give more information when examining some objects + * @param {Uint8} sets the value of History + */ set History(v) { return this._data.setUint8(15, v, true); } - /** - * get the struct representation of the object - */ - get bytes() { - return new Uint8Array(this._ptr); - } /** - * constructor + * Constructs a new Skills + * + * @param {{Artisan: Uint8, Culinary: Uint8, Ranged: Uint8, Melee: Uint8, Acrobatics: Uint8, Prestidigitation: Uint8, Engineering: Uint8, Metalworking: Uint8, Language: Uint8, Medicine: Uint8, Alchemy: Uint8, Fishing: Uint8, Mining: Uint8, Survival: Uint8, Gardening: Uint8, History: Uint8, }} init The arguments to construct the object. + * @param {Uint8Array} ptr The pointer to the C struct. */ constructor(init = {}, ptr = undefined) { this._size = 16; - this._ptr = ptr.buffer || new ArrayBuffer(this._size); - this._data = new DataView(this._ptr); + this._ptr = ptr || new Uint8Array(this._size); + this._data = new DataView(this._ptr.buffer); for (const key of Object.keys(init)) { this[key] = init[key]; diff --git a/server/components/Stats.js b/server/components/Stats.js index 72cf0bb..d5f0866 100644 --- a/server/components/Stats.js +++ b/server/components/Stats.js @@ -1,62 +1,92 @@ +/** + * @typedef {Object} Stats User stats + * @property {Uint8} u8 Physical attack damage + Equipment Load + * @property {Uint8} u8 HP + Dmg mitigation for physical damage, how much stamina you have + * @property {Uint8} u8 Use/build steampunk gadgets + be able to read specific logical papers + * @property {Uint8} u8 Number of magic / special attack / skills you can remember at one time. + * @property {Uint8} u8 how good you can talk, persuade, etc. + */ class Stats { /** * Physical attack damage + Equipment Load + * @return {Uint8} gets the value of Strength */ get Strength() { return this._data.getUint8(0, true); } + /** + * Physical attack damage + Equipment Load + * @param {Uint8} sets the value of Strength + */ set Strength(v) { return this._data.setUint8(0, v, true); } /** * HP + Dmg mitigation for physical damage, how much stamina you have + * @return {Uint8} gets the value of Endurance */ get Endurance() { return this._data.getUint8(1, true); } + /** + * HP + Dmg mitigation for physical damage, how much stamina you have + * @param {Uint8} sets the value of Endurance + */ set Endurance(v) { return this._data.setUint8(1, v, true); } /** * Use/build steampunk gadgets + be able to read specific logical papers + * @return {Uint8} gets the value of Intelligence */ get Intelligence() { return this._data.getUint8(2, true); } + /** + * Use/build steampunk gadgets + be able to read specific logical papers + * @param {Uint8} sets the value of Intelligence + */ set Intelligence(v) { return this._data.setUint8(2, v, true); } /** * Number of magic / special attack / skills you can remember at one time. + * @return {Uint8} gets the value of Wisdom */ get Wisdom() { return this._data.getUint8(3, true); } + /** + * Number of magic / special attack / skills you can remember at one time. + * @param {Uint8} sets the value of Wisdom + */ set Wisdom(v) { return this._data.setUint8(3, v, true); } /** * how good you can talk, persuade, etc. + * @return {Uint8} gets the value of Charisma */ get Charisma() { return this._data.getUint8(4, true); } + /** + * how good you can talk, persuade, etc. + * @param {Uint8} sets the value of Charisma + */ set Charisma(v) { return this._data.setUint8(4, v, true); } - /** - * get the struct representation of the object - */ - get bytes() { - return new Uint8Array(this._ptr); - } /** - * constructor + * Constructs a new Stats + * + * @param {{Strength: Uint8, Endurance: Uint8, Intelligence: Uint8, Wisdom: Uint8, Charisma: Uint8, }} init The arguments to construct the object. + * @param {Uint8Array} ptr The pointer to the C struct. */ constructor(init = {}, ptr = undefined) { this._size = 5; - this._ptr = ptr.buffer || new ArrayBuffer(this._size); - this._data = new DataView(this._ptr); + this._ptr = ptr || new Uint8Array(this._size); + this._data = new DataView(this._ptr.buffer); for (const key of Object.keys(init)) { this[key] = init[key]; diff --git a/server/components/Vector3.js b/server/components/Vector3.js index 38051b4..d6079ce 100644 --- a/server/components/Vector3.js +++ b/server/components/Vector3.js @@ -1,44 +1,62 @@ +/** + * @typedef {Object} Vector3 A representation of a position in 3D space + * @property {Float32} f32 x coordinate + * @property {Float32} f32 y coordinate + * @property {Float32} f32 z coordinate + */ class Vector3 { /** * x coordinate + * @return {Float32} gets the value of x */ get x() { return this._data.getFloat32(0, true); } + /** + * x coordinate + * @param {Float32} sets the value of x + */ set x(v) { return this._data.setFloat32(0, v, true); } /** * y coordinate + * @return {Float32} gets the value of y */ get y() { return this._data.getFloat32(4, true); } + /** + * y coordinate + * @param {Float32} sets the value of y + */ set y(v) { return this._data.setFloat32(4, v, true); } /** * z coordinate + * @return {Float32} gets the value of z */ get z() { return this._data.getFloat32(8, true); } + /** + * z coordinate + * @param {Float32} sets the value of z + */ set z(v) { return this._data.setFloat32(8, v, true); } - /** - * get the struct representation of the object - */ - get bytes() { - return new Uint8Array(this._ptr); - } /** - * constructor + * Constructs a new Vector3 + * + * @param {{x: Float32, y: Float32, z: Float32, }} init The arguments to construct the object. + * @param {Uint8Array} ptr The pointer to the C struct. */ constructor(init = {}, ptr = undefined) { this._size = 12; - this._ptr = ptr.buffer || new ArrayBuffer(this._size); - this._data = new DataView(this._ptr); + this._ptr = ptr || new Uint8Array(this._size); + this._data = new DataView(this._ptr.buffer); for (const key of Object.keys(init)) { this[key] = init[key]; diff --git a/server/schema.json b/server/schema.json index 7b6558f..d3bc97d 100644 --- a/server/schema.json +++ b/server/schema.json @@ -1,219 +1,240 @@ { "Vector3": { - "x": { - "type": "f32", - "kind": "scalar", - "comment": "x coordinate" - }, - "y": { - "type": "f32", - "kind": "scalar", - "comment": "y coordinate" - }, - "z": { - "type": "f32", - "kind": "scalar", - "comment": "z coordinate" + "comment": "A representation of a position in 3D space", + "members": { + "x": { + "type": "f32", + "kind": "scalar", + "comment": "x coordinate" + }, + "y": { + "type": "f32", + "kind": "scalar", + "comment": "y coordinate" + }, + "z": { + "type": "f32", + "kind": "scalar", + "comment": "z coordinate" + } } }, "Stats": { - "Strength": { - "type": "u8", - "kind": "scalar", - "comment": "Physical attack damage + Equipment Load" - }, - "Endurance": { - "type": "u8", - "kind": "scalar", - "comment": "HP + Dmg mitigation for physical damage, how much stamina you have" - }, - "Intelligence": { - "type": "u8", - "kind": "scalar", - "comment": "Use/build steampunk gadgets + be able to read specific logical papers" - }, - "Wisdom": { - "type": "u8", - "kind": "scalar", - "comment": "Number of magic / special attack / skills you can remember at one time." - }, - "Charisma": { - "type": "u8", - "kind": "scalar", - "comment": "how good you can talk, persuade, etc." + "comment": "User stats", + "members": { + "Strength": { + "type": "u8", + "kind": "scalar", + "comment": "Physical attack damage + Equipment Load" + }, + "Endurance": { + "type": "u8", + "kind": "scalar", + "comment": "HP + Dmg mitigation for physical damage, how much stamina you have" + }, + "Intelligence": { + "type": "u8", + "kind": "scalar", + "comment": "Use/build steampunk gadgets + be able to read specific logical papers" + }, + "Wisdom": { + "type": "u8", + "kind": "scalar", + "comment": "Number of magic / special attack / skills you can remember at one time." + }, + "Charisma": { + "type": "u8", + "kind": "scalar", + "comment": "how good you can talk, persuade, etc." + } } }, "Skills": { - "Artisan": { - "type": "u8", - "kind": "scalar", - "comment": "Crafting, visual arts, etc." - }, - "Culinary": { - "type": "u8", - "kind": "scalar", - "comment": "cooking, baking, brewing, " - }, - "Ranged": { - "type": "u8", - "kind": "scalar", - "comment": "using guns/cannons, bows, etc." - }, - "Melee": { - "type": "u8", - "kind": "scalar", - "comment": "using swords, hammers, pole-arms etc." - }, - "Acrobatics": { - "type": "u8", - "kind": "scalar", - "comment": "being able to contort, move, dodge, etc." - }, - "Prestidigitation": { - "type": "u8", - "kind": "scalar", - "comment": "skullduggery, lock-picking, deceiving, slight of hand" - }, - "Engineering": { - "type": "u8", - "kind": "scalar", - "comment": " creating and using contraptions, building houses" - }, - "Metalworking": { - "type": "u8", - "kind": "scalar", - "comment": "obvious, but in this you can also use automatic stuff" - }, - "Language": { - "type": "u8", - "kind": "scalar", - "comment": "ability to read/write a specific language" - }, - "Medicine": { - "type": "u8", - "kind": "scalar", - "comment": "healing hp, getting rid of diseases, etc." - }, - "Alchemy": { - "type": "u8", - "kind": "scalar", - "comment": "Creating potions, creating alloys, creating chemicals, component based 'magic'" - }, - "Fishing": { - "type": "u8", - "kind": "scalar", - "comment": "collecting fish" - }, - "Mining": { - "type": "u8", - "kind": "scalar", - "comment": "collecting ore" - }, - "Survival": { - "type": "u8", - "kind": "scalar", - "comment": "woodcutting, fire-making, hunting, collecting herbs, etc." - }, - "Gardening": { - "type": "u8", - "kind": "scalar", - "comment": "growing plants, herbs, etc." - }, - "History": { - "type": "u8", - "kind": "scalar", - "comment": "will give more information when examining some objects" + "comment": "User skills", + "members": { + "Artisan": { + "type": "u8", + "kind": "scalar", + "comment": "Crafting, visual arts, etc." + }, + "Culinary": { + "type": "u8", + "kind": "scalar", + "comment": "cooking, baking, brewing, " + }, + "Ranged": { + "type": "u8", + "kind": "scalar", + "comment": "using guns/cannons, bows, etc." + }, + "Melee": { + "type": "u8", + "kind": "scalar", + "comment": "using swords, hammers, pole-arms etc." + }, + "Acrobatics": { + "type": "u8", + "kind": "scalar", + "comment": "being able to contort, move, dodge, etc." + }, + "Prestidigitation": { + "type": "u8", + "kind": "scalar", + "comment": "skullduggery, lock-picking, deceiving, slight of hand" + }, + "Engineering": { + "type": "u8", + "kind": "scalar", + "comment": " creating and using contraptions, building houses" + }, + "Metalworking": { + "type": "u8", + "kind": "scalar", + "comment": "obvious, but in this you can also use automatic stuff" + }, + "Language": { + "type": "u8", + "kind": "scalar", + "comment": "ability to read/write a specific language" + }, + "Medicine": { + "type": "u8", + "kind": "scalar", + "comment": "healing hp, getting rid of diseases, etc." + }, + "Alchemy": { + "type": "u8", + "kind": "scalar", + "comment": "Creating potions, creating alloys, creating chemicals, component based 'magic'" + }, + "Fishing": { + "type": "u8", + "kind": "scalar", + "comment": "collecting fish" + }, + "Mining": { + "type": "u8", + "kind": "scalar", + "comment": "collecting ore" + }, + "Survival": { + "type": "u8", + "kind": "scalar", + "comment": "woodcutting, fire-making, hunting, collecting herbs, etc." + }, + "Gardening": { + "type": "u8", + "kind": "scalar", + "comment": "growing plants, herbs, etc." + }, + "History": { + "type": "u8", + "kind": "scalar", + "comment": "will give more information when examining some objects" + } } }, "DerivedStats": { - "Hitpoints": { - "type": "u8", - "kind": "scalar", - "comment": "how many hits you can take, if it reaches 0 you ded!" - }, - "Stamina": { - "type": "u8", - "kind": "scalar", - "comment": "How many strenuous actions you can take, i.e. swinging a hammer, attacking, fishing, etc." - }, - "Perception": { - "type": "u8", - "kind": "scalar", - "comment": "being able to observe some objects" - }, - "Luck": { - "type": "u8", - "kind": "scalar", - "comment": "Get better probability rolls for things that matter for rolls" - }, - "Stealth": { - "type": "u8", - "kind": "scalar", - "comment": "Probability of being discovered when hiding" - }, - "Attractiveness": { - "type": "u8", - "kind": "scalar", - "comment": "based on your character you make in the creator. more attractive will have better outcomes with aristocracy and more 'ugly' will have better outcomes with working class." - }, - "Affluence": { - "type": "u8", - "kind": "scalar", - "comment": "same as attractiveness but can change with money" - }, - "Holyness": { - "type": "i8", - "kind": "scalar", - "comment": "how attuned to the vision of Eru" + "comment": "Derived user stats", + "members": { + "Hitpoints": { + "type": "u8", + "kind": "scalar", + "comment": "how many hits you can take, if it reaches 0 you ded!" + }, + "Stamina": { + "type": "u8", + "kind": "scalar", + "comment": "How many strenuous actions you can take, i.e. swinging a hammer, attacking, fishing, etc." + }, + "Perception": { + "type": "u8", + "kind": "scalar", + "comment": "being able to observe some objects" + }, + "Luck": { + "type": "u8", + "kind": "scalar", + "comment": "Get better probability rolls for things that matter for rolls" + }, + "Stealth": { + "type": "u8", + "kind": "scalar", + "comment": "Probability of being discovered when hiding" + }, + "Attractiveness": { + "type": "u8", + "kind": "scalar", + "comment": "based on your character you make in the creator. more attractive will have better outcomes with aristocracy and more 'ugly' will have better outcomes with working class." + }, + "Affluence": { + "type": "u8", + "kind": "scalar", + "comment": "same as attractiveness but can change with money" + }, + "Holyness": { + "type": "i8", + "kind": "scalar", + "comment": "how attuned to the vision of Eru" + } } }, "Entity": { - "Name": { - "type": "string", - "kind": "string", - "size": "24", - "comment": "Name of the entity" - }, - "Vector3": { - "type": "Vector3", - "kind": "struct", - "comment": "Vector3 of the entity in space" - }, - "Stats": { - "type": "Stats", - "kind": "struct", - "comment": "Base stats" - }, - "DerivedStats": { - "type": "DerivedStats", - "kind": "struct", - "comment": "Stats that are derived from skills and base stats" - }, - "Skills": { - "type": "Skills", - "kind": "struct", - "comment": "Stuff that your character can do" + "comment": "Something that can exist in 3D space", + "members": { + "Name": { + "type": "string", + "kind": "string", + "size": "24", + "comment": "Name of the entity" + }, + "Vector3": { + "type": "Vector3", + "kind": "struct", + "comment": "Vector3 of the entity in space" + }, + "Stats": { + "type": "Stats", + "kind": "struct", + "comment": "Base stats" + }, + "DerivedStats": { + "type": "DerivedStats", + "kind": "struct", + "comment": "Stats that are derived from skills and base stats" + }, + "Skills": { + "type": "Skills", + "kind": "struct", + "comment": "Stuff that your character can do" + } } }, "Item": { - "Name": { - "type": "string", - "kind": "string", - "size": "24", - "comment": "Name of the item" - }, - "BaseValue": { - "type": "i32", - "kind": "scalar", - "comment": "Default starting value of the item" + "comment": "Item", + "members": { + "Name": { + "type": "string", + "kind": "string", + "size": "24", + "comment": "Name of the item" + }, + "BaseValue": { + "type": "i32", + "kind": "scalar", + "comment": "Default starting value of the item" + } } }, "Phenomenon": { - "Name": { - "type": "string", - "kind": "string", - "size": "64", - "comment": "Name of the phenomenon" + "comment": "Kinda like an action, cant remember", + "members": { + "Name": { + "type": "string", + "kind": "string", + "size": "64", + "comment": "Name of the phenomenon" + } } } } diff --git a/tools/js-class-c-struct-transpiler/test/schema.json b/tools/js-class-c-struct-transpiler/test/schema.json index ec957e1..638e51e 100644 --- a/tools/js-class-c-struct-transpiler/test/schema.json +++ b/tools/js-class-c-struct-transpiler/test/schema.json @@ -1,5 +1,6 @@ { "Vector3": { + "type": "struct", "comment": "A representation of a position in 3D space", "members": { "x": { @@ -20,6 +21,7 @@ } }, "Login": { + "type": "struct", "comment": "The login object", "members": { "Email": { @@ -37,6 +39,7 @@ } }, "User": { + "type": "struct", "comment": "The user object", "members": { "Name": { @@ -58,6 +61,7 @@ } }, "LoginRequest": { + "type": "request", "comment": "a request for a login", "members": { "Login": { @@ -68,6 +72,7 @@ } }, "LoginResponse": { + "type": "response", "comment": "the response from a login request", "members": { "success": {