Skip to content

Commit

Permalink
Merge branch 'fix/tileset-cache' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
RSamaium committed Aug 15, 2023
2 parents b39993c + 71ecc87 commit 346ce3a
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 6 deletions.
26 changes: 23 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: RPG CI
on:
push:
branches:
- v4
- '*'
pull_request:
branches:
- v4
- '*'

jobs:
tests:
Expand All @@ -22,4 +22,24 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm i
- run: npm test
- run: npm test

build_and_publish:
needs: tests
if: github.ref == 'refs/heads/v4'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
- run: npm i
- run: npm run build
- name: Bump version using conventional commits
run: npx lerna version --conventional-commits --no-push --yes
- name: Publish to NPM
run: npm run lerna:actions:publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"postinstall": "lerna bootstrap --ci && npm run build:types && npm run build:tiled && npm run build:common && npm run build:client && npm run build:database && npm run build:server && npm run build:testing && npm run build:compiler && cd packages/client && cd ../../packages/plugins/agones/matchmaker && npm i",
"test": "vitest --config ./packages/compiler/src/test/vitest.config.ts && cd ./packages/compiler && npm test",
"lerna:publish": "lerna publish --ignore-prepublish --force-publish --no-private --no-push --no-git-tag-version",
"lerna:actions:publish": "lerna publish from-git --ignore-prepublish --force-publish --no-private --no-push --no-git-tag-version --yes",
"lerna:ls": "lerna ls",
"build": "concurrently -n build \"npm:build:*\" && npm run fix-esm",
"build:common": "cd packages/common && npm run build",
Expand Down
2 changes: 2 additions & 0 deletions packages/sample2/main/events/npc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export default class CharaEvent extends RpgEvent {
onInit() {
this.setGraphic('male')
this.setHitbox(32, 32)
this.throughOtherPlayer = true
this.through = true
}
async onAction(player: RpgPlayer) {
await player.showText('Hello ', {
Expand Down
14 changes: 14 additions & 0 deletions packages/sample2/main/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,26 @@ import { RpgMap } from '@rpgjs/server';
import { Speed } from '@rpgjs/server';
import { RpgPlayer, RpgPlayerHooks, Control, Components, RpgEvent, EventData } from '@rpgjs/server'
import Potion from './database/items/Potion';
import CharaEvent from './events/npc';

const player: RpgPlayerHooks = {
onConnected(player: RpgPlayer) {
player.name = 'YourName'
player.setComponentsTop(Components.text('{name}'))
},
onInput(player: RpgPlayer, { input }) {
if (input == 'action') {
const map = player.getCurrentMap()
const event = map?.createDynamicEvent({
x: player.position.x + 5,
y: player.position.y + 5,
event: CharaEvent,
});
}
if (input == 'back') {
player.callMainMenu()
}
},
async onJoinMap(player: RpgPlayer, map: RpgMap) {
player.save();
}
Expand Down
8 changes: 7 additions & 1 deletion packages/sample2/main/sprite.ts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
export default {}
import { RpgSprite, RpgSpriteHooks } from '@rpgjs/client'

const sprite: RpgSpriteHooks = {

}

export default sprite
2 changes: 1 addition & 1 deletion packages/server/src/Game/Map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ export class RpgMap extends RpgCommonMap {
}
else {
event = obj.event
position = { x: obj.x, y: obj.y, z: 0 }
position = { x: obj.x, y: obj.y, z: obj.z ?? 0 }
}

// The event is ignored if the mode is different.
Expand Down
4 changes: 3 additions & 1 deletion packages/tiled/src/classes/Map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,9 @@ export class MapClass extends TiledProperties {
private mapTilesets() {
this.tilesets = this.tilesets.map(tileset => {
if (bufferTilesets[tileset.name]) {
return bufferTilesets[tileset.name]
const instance = bufferTilesets[tileset.name]
instance.firstgid = tileset.firstgid
return instance
}
const _tileset = new Tileset(tileset)
bufferTilesets[_tileset.name] = _tileset
Expand Down

0 comments on commit 346ce3a

Please sign in to comment.