Skip to content

Commit

Permalink
Merge pull request #5 from numengames/feat/event-storage-password-imp…
Browse files Browse the repository at this point in the history
…rovements

feat: add EventStorageReceiver, improve password handling, and update CHANGELOG.md
  • Loading branch information
DevStarlight authored Oct 8, 2024
2 parents 086e0f4 + 937540d commit 2dfc8d3
Show file tree
Hide file tree
Showing 23 changed files with 745 additions and 287 deletions.
6 changes: 4 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@
"plugin:react/recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"prettier"
],
"settings": {
"react": {
"version": "detect",
"version": "detect"
}
},
"rules": {
"quotes": ["error", "single"],
"object-curly-spacing": ["off"],
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "error"
Expand Down
5 changes: 3 additions & 2 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"arrowParens": "avoid"
}
"arrowParens": "avoid",
"bracketSpacing": true
}
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/).

## [1.4.0] - 2024-10-08

### Added
- **EventStorageReceiver**: Added `EventStorageReceiver` to store events for future processing.
- **InsertPasswordEmitter**: Improved `InsertPasswordEmitter` to notify the `InteractionDirector` if the password was successfully resolved.
- **InsertPasswordPrompt**: Enhanced the UX and flow of the password prompt.

### Fixed
- **RotateReceiver, TeleportReceiver, TranslateReceiver**: Fixed issues in the behavior of rotate, teleport, and translate receivers.
- **Fade utilities**: Resolved bugs in the fade utilities (`fadeIn` and `fadeOut`).

### Changed
- **appState**: Minor updates in the global state management with `appState`.
- **InteractionDirector**: Improved component state handling and event emission logic.
- **Eslint and Prettier**: Updated eslint and prettier configurations.

## [1.3.0] - 2024-09-20

### Added
Expand Down
46 changes: 22 additions & 24 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
---
name: Bug Report
about: Report a bug to help us improve
about: Report an issue related to data models or schema errors
title: ''
labels: 'bug'
assignees: ''
---

**Describe the bug**
A clear and concise description of what the bug is.
**Describe the bug**
A clear and concise description of what the bug is related to the data model or schema (e.g., validation error, incorrect schema, missing field).

**To Reproduce**
Steps to reproduce the behavior:
**To Reproduce**
Steps to reproduce the issue:

1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error
1. Query or operation that triggered the bug.
2. The expected vs actual result.
3. Example of data or payload used (if applicable).

**Expected behavior**
A clear and concise description of what you expected to happen.
**Expected behavior**
A clear and concise description of what you expected the schema or data model to do.

**Screenshots**
If applicable, add screenshots to help explain your problem.
**Logs and Error Messages**
If applicable, include relevant logs or error messages that help diagnose the issue (e.g., validation errors, MongoDB errors).

**Desktop (please complete the following information):**
**Database Details**

- OS: [e.g. Windows, macOS]
- Browser [e.g. Chrome, Safari]
- Version [e.g. 22]
- MongoDB version: [e.g. 4.2]
- Mongoose version: [e.g. 6.0]
- Node.js version: [e.g. 20.x]

**Smartphone (please complete the following information):**
**Environment (if applicable)**

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, Safari]
- Version [e.g. 22]
- OS: [e.g. Ubuntu, macOS]
- Node.js Version: [e.g. 16.14.0]
- Mongoose Version: [e.g. 6.2.1]

**Additional context**
Add any other context about the problem here.
**Additional context**
Add any other context related to the problem. For example, is it happening only with certain queries or data?
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "numinia-oncyber",
"version": "1.3.0",
"version": "1.4.0",
"description": "This project is a warehouse of components designed to implement various functionalities within the Oncyber platform. These components can be used to enhance and customize spaces or levels in Oncyber.",
"private": "true",
"type": "module",
Expand All @@ -22,7 +22,7 @@
"oncyber"
],
"author": "Numinia",
"license": "ISC",
"license": "MIT",
"bugs": {
"url": "https://github.com/numengames/numinia-oncyber/issues"
},
Expand Down Expand Up @@ -58,4 +58,4 @@
"react-dom": "^18.3.1",
"three": "^0.163.0"
}
}
}
73 changes: 68 additions & 5 deletions src/behaviors/emitters/BaseEmitter.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { Folder, Param, $Param, ScriptBehavior } from '@oo/scripting';

import InteractionDirector from '../../common/interactions/InteractionDirector';
import InteractionDirector, {
InteractionDirectorOptionParams,
} from '../../common/interactions/InteractionDirector';

interface BaseEmitterParams {
triggerKey?: string;
interactionMode: string;
triggerDistance?: number;
xInteractionAdjustment?: number;
yInteractionAdjustment?: number;
zInteractionAdjustment?: number;
}

/**
Expand All @@ -19,10 +23,10 @@ export default class BaseEmitter extends ScriptBehavior {
};

@Param({ name: 'Signal sender' })
private enterSignal = $Param.Signal();
private senderSignal = $Param.Signal();

@Param({ type: 'boolean', defaultValue: false, name: 'Can emit signals multiple times?' })
private doesEmitMultipleTimes = false;
private isActiveMultipleTimes = false;

@Folder('Interaction Mode')
@Param({
Expand All @@ -32,19 +36,41 @@ export default class BaseEmitter extends ScriptBehavior {
options: ['Auto', 'Key'],
})
private interactionMode = 'Auto';

@Param({
type: 'string',
name: 'Trigger key',
visible: (params: BaseEmitterParams) => params.interactionMode === 'Key',
})
private triggerKey = 'E';

@Param({
min: -20,
step: 0.1,
type: 'number',
name: 'X Key dialog adjustment',
visible: (params: BaseEmitterParams) => params.interactionMode === 'Key',
})
private xInteractionAdjustment = 0;

@Param({
min: -20,
step: 0.1,
type: 'number',
name: 'Key dialog adjustment',
name: 'Y Key dialog adjustment',
visible: (params: BaseEmitterParams) => params.interactionMode === 'Key',
})
private yInteractionAdjustment = 0;

@Param({
min: -20,
step: 0.1,
type: 'number',
name: 'Z Key dialog adjustment',
visible: (params: BaseEmitterParams) => params.interactionMode === 'Key',
})
private zInteractionAdjustment = 0;

@Param({
min: 0.1,
step: 0.1,
Expand All @@ -55,10 +81,47 @@ export default class BaseEmitter extends ScriptBehavior {
})
private triggerDistance = 2;

private options?: InteractionDirectorOptionParams;

/**
* Called when the script is ready.
*/
onReady = async () => {
await InteractionDirector.handle(this, () => this.enterSignal.emit());
this.options = {
interactionAdjustment: {
x: this.xInteractionAdjustment,
y: this.yInteractionAdjustment,
z: this.zInteractionAdjustment,
},
triggerDistance: this.triggerDistance,
isActiveMultipleTimes: this.isActiveMultipleTimes,
};

await InteractionDirector.handle(
{
host: this.host,
triggerKey: this.triggerKey,
options: { interactionMode: this.interactionMode },
},
this.handleInteractionStart.bind(this),
this.handleInteractionEnd.bind(this),
this.options,
);
};

/**
* Handles what happens when the interaction starts.
* @param {Function} callback - Optional callback to notify success or failure.
*/
private handleInteractionStart(callback?: (response: boolean) => void) {
if (callback) {
callback(true);
}
this.senderSignal.emit();
}

/**
* Handles what happens when the interaction ends.
*/
private handleInteractionEnd() {}
}
Loading

0 comments on commit 2dfc8d3

Please sign in to comment.