-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Added** - Support for YAML and JSON configuration files for game setup. - New fields in the Event struct: add_subject: Adds a new subject to the room when the event is triggered. remove_subject: Removes a subject from the room when the event is triggered. move_subject_to_location: Moves a subject to a different room when the event is triggered. - Error handling for missing or invalid event data. - Proper error messages for parsing errors and missing data. - Serialization and deserialization support for game progress saving and loading. **Changed** - Refactored handle_event function to improve readability and maintainability. - Updated process_subject_movement function to handle subject movement and removal separately. - Modified return_formated_message function to simplify the logic and improve performance. - Enhanced error handling in the parse_input and json_parse_input functions. - Improved documentation and code comments for better understanding and usability. - Updated wasm examples **Fixed** - Fixed issue with multiple mutable borrows in the on_submit function. - Fixed incorrect behavior when processing subject movement and removal in events. **Removed** - Removed unused dependencies and code snippets. - Removed redundant and obsolete documentation.
- Loading branch information
Showing
44 changed files
with
4,173 additions
and
2,285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,15 +12,11 @@ jobs: | |
CARGO_INCREMENTAL: 0 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- uses: jetli/[email protected] | ||
- uses: actions/checkout@v4 | ||
- name: Setup wasm-pack | ||
run: cargo install wasm-pack | ||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
|
@@ -29,6 +25,6 @@ jobs: | |
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} | ||
- uses: katyo/publish-crates@v1 | ||
- uses: katyo/publish-crates@v2 | ||
with: | ||
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,15 +13,11 @@ jobs: | |
CARGO_INCREMENTAL: 0 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- uses: jetli/[email protected] | ||
- uses: actions/checkout@v4 | ||
- name: Setup wasm-pack | ||
run: cargo install wasm-pack | ||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
|
@@ -33,7 +29,7 @@ jobs: | |
- name: Package file | ||
run: wasm-pack build --target web --scope nightrunner --release | ||
- name: Deploy to NPM | ||
uses: JS-DevTools/npm-publish@v1 | ||
uses: JS-DevTools/npm-publish@v3 | ||
with: | ||
token: ${{ secrets.NPM_TOKEN }} | ||
package: ./pkg/package.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,15 +12,9 @@ jobs: | |
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
components: rustfmt, clippy | ||
- uses: actions/checkout@v4 | ||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
|
@@ -30,41 +24,26 @@ jobs: | |
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} | ||
- name: Build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
run: cargo build | ||
- name: Test | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
run: cargo test | ||
- name: Check fmt | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
run: cargo fmt --all -- --check | ||
- name: Clippy | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: -- -D warnings | ||
run: cargo clippy -- -D warnings | ||
wasm: | ||
needs: ci | ||
name: Test WASM library | ||
env: | ||
CARGO_INCREMENTAL: 0 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
target: wasm32-unknown-unknown | ||
override: true | ||
- uses: jetli/[email protected] | ||
- uses: actions/checkout@v4 | ||
- name: Setup wasm-pack | ||
run: cargo install wasm-pack | ||
- uses: browser-actions/setup-firefox@latest | ||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/target | ||
Cargo.lock | ||
.DS_Store | ||
pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
[package] | ||
name = "nightrunner_lib" | ||
version = "0.2.1" | ||
version = "0.3.0" | ||
edition = "2021" | ||
resolver="2" | ||
authors = ["Aimeri Baddouh <[email protected]>"] | ||
description = "A parser library for making text adventure games" | ||
license = "Apache-2.0" | ||
|
@@ -11,27 +12,30 @@ categories = ["parsing"] | |
keywords = ["engine", "parsing", "wasm", "game"] | ||
readme = "README.md" | ||
|
||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_yaml = "0.8" | ||
serde_json = "1.0" | ||
regex = "1" | ||
wasm-bindgen = { version = "0.2", features = ["serde-serialize"] } | ||
wasm-bindgen = { version = "0.2.92", features = ["serde-serialize"] } | ||
serde-wasm-bindgen = "0.6.5" | ||
rand = "0.8.5" | ||
getrandom = { version = "0.2.12", features = ["js"] } | ||
serde_yaml = "0.9.33" | ||
console_error_panic_hook = "0.1.7" | ||
|
||
[dev-dependencies] | ||
pretty_assertions = "1.1.0" | ||
wasm-bindgen-test = "0.3.29" | ||
pretty_assertions = "1.4.0" | ||
wasm-bindgen-test = "0.3.42" | ||
|
||
|
||
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] | ||
cursive = { version = "0.17.0", default-features = false, features = [ | ||
"crossterm-backend", | ||
] } | ||
cursive = { version = "0.20.0", default-features = false, features = ["crossterm-backend"] } | ||
cursive-aligned-view = "0.6.0" | ||
|
||
[[example]] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.