narrat 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,103 @@
1
+ # Narrat changelog
2
+
3
+ ## 0.6.0
4
+
5
+ Added stats feature for tracking numbers and displaying them in the hud
6
+
7
+ Example config:
8
+
9
+ ```
10
+ "hudStats": {
11
+ "money": {
12
+ "icon": "img/ui/money.png",
13
+ "name": "Money",
14
+ "startingValue": 0,
15
+ "minValue": 0
16
+ },
17
+ "energy": {
18
+ "icon": "img/ui/energy.png",
19
+ "name": "Energy",
20
+ "startingValue": 10,
21
+ "minValue": 0,
22
+ "maxValue": 10
23
+ }
24
+ }
25
+ ```
26
+
27
+ ## 0.5.4
28
+
29
+ - Improved responsive layout and fixed some issues in it
30
+
31
+ New config keys required in the layout part of the config (to be documented):
32
+
33
+ ```
34
+ "layout": {
35
+ "backgrounds": {
36
+ "width": 880,
37
+ "height": 720
38
+ },
39
+ "dialogBottomPadding": 70,
40
+ "minTextWidth": 475,
41
+ "mobileDialogHeightPercentage": 60,
42
+ "verticalLayoutThreshold": 1000,
43
+ "portraits": {
44
+ "width": 100,
45
+ "height": 100
46
+ }
47
+ },
48
+ ```
49
+
50
+ ## 0.4.0
51
+
52
+ Added responsive layout for mobile and small screens. Still in progress, but functionnal enough to be better than before so I'm releasing it.
53
+
54
+ ## 0.3.4
55
+
56
+ - Improved string templating to work with deep nesting and also inside choice text
57
+
58
+ ## 0.3.3
59
+
60
+ - Now detects indentation size and can support any indentation size
61
+
62
+ ## 0.3.2
63
+
64
+ - Added a new `add_level` function for increasing the level of a skill. Example: `add_level someSkill 1` will increase the player's level in `someSkill` by 1
65
+ - Added a new `notify` function for displaying a notification toast that disappears after a few seconds (duration configurable in `config.json`). Example: `notify "Hello, this is a notification"`.
66
+
67
+ ## 0.3.1
68
+
69
+ Added new config options for controlling how skill rolls are done and the display of their difficulty
70
+
71
+ ## 0.3.0
72
+
73
+ Breaking changes around renaming data access from scripts
74
+
75
+ ### New Add Command
76
+
77
+ New `add` command, works the same way as `set` but increments the value based on the existing value, ie. `set SKILLS.someSkill.level 2` will increment `someSkill.level` by 2.
78
+
79
+ ### Skills
80
+
81
+ - Now possible to set the starting value of a skill (in the config)
82
+ - Now possible to edit a skill's value with `set SKILLS.someSkill.level 2` for example
83
+ - Skillcheck command renamed to roll (`if this.roll("someSkillCheck", "testSkill", 40);`)
84
+
85
+ ### General
86
+
87
+ The `set` and `$if` command now refer to data in caps and have access to more data:
88
+
89
+ - `set SKILLS.someSkill.level [value]` Sets the value of a skill
90
+ - `set DATA.someData [value]` Sets a value in the data object (data is for any game-created variables)
91
+ - `$if this.SKILLCHECKS.someSkillCheck.passed` now available for checking if a skillcheck has already been passed
92
+
93
+ ## 0.0.14
94
+
95
+ - Added the changelog (manually made for now)
96
+
97
+ ## 0.0.13
98
+
99
+ - Added debug menu for jumping to labels (currently doesn't support production builds disabling it)
100
+ - Added saving and loading of the game (works by storing data, skills, skillchecks etc. When the game is reloaded, it is brought back at the last label visited)
101
+ - Fixed a bug where conditional choices would play the wrong result if a choice is removed due to a condition
102
+ - Made script loading and compilation happen during the initial loading, so everything is ready to play when pressing start game
103
+ - Skill checks now also save and load their data, so a failed check becomes impossible to choose, and a succeeded skill check can be skipped if shown again
package/lib/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version: 0.6.2 - September 1, 2021 22:01:28
1
+ // Version: 0.6.3 - April 25, 2022 16:37:54
2
2
  import 'es6-promise/auto';
3
3
  import { ref, reactive, readonly, defineComponent, openBlock, createElementBlock, normalizeStyle, createElementVNode, createCommentVNode, Fragment, renderList, createBlock, Transition, withCtx, renderSlot, createTextVNode, resolveComponent, toDisplayString, createVNode, TransitionGroup, createApp } from 'vue';
4
4
  import { createLogger, createStore } from 'vuex';
@@ -4157,20 +4157,18 @@ async function loadAudioAssets(config) {
4157
4157
  console.log(`Loading audio`);
4158
4158
  const loadingPromises = [];
4159
4159
  for (const key in config.sound) {
4160
- const path = config.sound[key].path;
4161
- loadingPromises.push(loadAudio(key, path, audio.sound));
4160
+ loadingPromises.push(loadAudio(key, { loop: true, html5: true, ...config.sound[key] }, audio.sound));
4162
4161
  }
4163
4162
  for (const key in config.music) {
4164
- const path = config.music[key].path;
4165
- loadingPromises.push(loadAudio(key, path, audio.music));
4163
+ loadingPromises.push(loadAudio(key, config.music[key], audio.music));
4166
4164
  }
4167
4165
  return Promise.all(loadingPromises);
4168
4166
  }
4169
- async function loadAudio(key, path, dest) {
4167
+ async function loadAudio(key, config, dest) {
4170
4168
  return new Promise((resolve, reject) => {
4171
- console.log(`Loading audio ${path}`);
4169
+ console.log(`Loading audio ${config.src}`);
4172
4170
  const sound = new howler.Howl({
4173
- src: [path],
4171
+ ...config,
4174
4172
  });
4175
4173
  sound.load();
4176
4174
  dest[key] = sound;
@@ -5731,7 +5729,7 @@ async function startApp(config, options) {
5731
5729
  mousePos.x = e.clientX;
5732
5730
  mousePos.y = e.clientY;
5733
5731
  });
5734
- console.log('%c Narrat game engine – 0.6.2 - September 1, 2021 22:01:28', 'background: #222; color: #bada55');
5732
+ console.log('%c Narrat game engine – 0.6.3 - April 25, 2022 16:37:54', 'background: #222; color: #bada55');
5735
5733
  const storeSetup = setupStore(options);
5736
5734
  store$1 = storeSetup.store;
5737
5735
  app = createApp(script$8, {
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // Version: 0.6.2 - September 1, 2021 22:01:28
1
+ // Version: 0.6.3 - April 25, 2022 16:37:54
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -4161,20 +4161,18 @@ async function loadAudioAssets(config) {
4161
4161
  console.log(`Loading audio`);
4162
4162
  const loadingPromises = [];
4163
4163
  for (const key in config.sound) {
4164
- const path = config.sound[key].path;
4165
- loadingPromises.push(loadAudio(key, path, audio.sound));
4164
+ loadingPromises.push(loadAudio(key, { loop: true, html5: true, ...config.sound[key] }, audio.sound));
4166
4165
  }
4167
4166
  for (const key in config.music) {
4168
- const path = config.music[key].path;
4169
- loadingPromises.push(loadAudio(key, path, audio.music));
4167
+ loadingPromises.push(loadAudio(key, config.music[key], audio.music));
4170
4168
  }
4171
4169
  return Promise.all(loadingPromises);
4172
4170
  }
4173
- async function loadAudio(key, path, dest) {
4171
+ async function loadAudio(key, config, dest) {
4174
4172
  return new Promise((resolve, reject) => {
4175
- console.log(`Loading audio ${path}`);
4173
+ console.log(`Loading audio ${config.src}`);
4176
4174
  const sound = new howler.Howl({
4177
- src: [path],
4175
+ ...config,
4178
4176
  });
4179
4177
  sound.load();
4180
4178
  dest[key] = sound;
@@ -5735,7 +5733,7 @@ async function startApp(config, options) {
5735
5733
  mousePos.x = e.clientX;
5736
5734
  mousePos.y = e.clientY;
5737
5735
  });
5738
- console.log('%c Narrat game engine – 0.6.2 - September 1, 2021 22:01:28', 'background: #222; color: #bada55');
5736
+ console.log('%c Narrat game engine – 0.6.3 - April 25, 2022 16:37:54', 'background: #222; color: #bada55');
5739
5737
  const storeSetup = setupStore(options);
5740
5738
  store$1 = storeSetup.store;
5741
5739
  app = vue.createApp(script$8, {
@@ -1,4 +1,4 @@
1
- import { Config } from '@/types/config';
1
+ import { Config, MusicConfig, SoundConfig } from '@/types/config';
2
2
  import { Howl } from 'howler';
3
3
  import { State } from 'vue';
4
4
  import { ActionContext, Commit } from 'vuex';
@@ -11,7 +11,7 @@ export declare const audio: {
11
11
  };
12
12
  };
13
13
  export declare function loadAudioAssets(config: Config): Promise<void[]>;
14
- export declare function loadAudio(key: string, path: string, dest: {
14
+ export declare function loadAudio(key: string, config: SoundConfig | MusicConfig, dest: {
15
15
  [key: string]: Howl;
16
16
  }): Promise<void>;
17
17
  export declare function changeMusic(ctx: ActionContext<State, State>, newMusic: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "narrat",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "narrat narrative engine",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",