Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Removed simplify helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
2767mr committed Jun 4, 2019
1 parent 9799f7f commit b749ba5
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion assets/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "multiplayer",
"main": "mod.js",
"version": "0.0.4",
"version": "0.0.7",
"dependencies": {
"ccloader": "^2.0.0",
"crosscode": "^1.0.0"
Expand Down
2 changes: 2 additions & 0 deletions src/@types/crosscode/fixes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ declare namespace ig {
multiplayerId?: number;
face: Vector2;
currentAnim: string;
currentState: string;
animState: ig.AnimationState;
}

interface Gui {
Expand Down
2 changes: 1 addition & 1 deletion src/listeners/connection/onKillEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class OnKillEntityListener {
return;
}

simplify.killEntity(this.main.entities[id]);
this.main.entities[id].kill();
delete this.main.entities[id];
}
}
4 changes: 2 additions & 2 deletions src/listeners/connection/onSetHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class OnSetHostListener {
set(value: ig.Vector2) { face = value; },
});

let state = simplify.getCurrentState(entity);
let state = entity.currentState;
Object.defineProperty(entity, 'currentState', {
get() { return state; },
set(value: string) { state = value; },
Expand Down Expand Up @@ -92,7 +92,7 @@ export class OnSetHostListener {
Object.defineProperty(entity, 'face',
{ get() { return protectedFace; }, set() {console.log('tried to maniplulate face'); } });

let protectedState = simplify.getCurrentState(entity);
let protectedState = entity.currentState;
Object.defineProperty(entity, 'currentState', {
get() { return protectedState; },
set(data) { if (data.protected) { protectedState = data.protected; } },
Expand Down
2 changes: 1 addition & 1 deletion src/listeners/connection/onThrowBall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class OnThrownBallListener {
}

const actonStep = new ig.ACTION_STEP.SHOOT_PROXY({ proxy: ballInfo.ballInfo, dir: ballInfo.dir });
simplify.runAction(actonStep, entity);
actonStep.run(entity);
}

private resolveEntity(combatant: number | string | undefined): ig.Entity | undefined {
Expand Down
2 changes: 1 addition & 1 deletion src/listeners/connection/onUpdateAnimationTimer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class OnUpdateAnimationTimerListener {
public onUpdateAnimationTimer(player: string, time: number): void {
const pl = this.main.players[player];
if (pl && pl.entity) {
simplify.setAnimationTimer(pl.entity, time);
pl.entity.animState.timer = time;
}
}
}
2 changes: 1 addition & 1 deletion src/listeners/connection/onUpdateEntityAnimation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ export class OnUpdateEntityAnimationListener {
private setEntityAnimation(from: {face: ig.Vector2, anim: string}, to: ig.Entity) {
to.face.xProtected = from.face.x;
to.face.yProtected = from.face.y;
simplify.setAnimation(to, {protected: from.anim});
to.currentAnim = {protected: from.anim} as unknown as string;
}
}
2 changes: 1 addition & 1 deletion src/listeners/connection/onUpdateEntityHealth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class OnUpdateEntityHealthListener {

console.log('[multiplayer] Set ' + id + '\'s health to ' + health);

simplify.setCurrentHp(entity, health);
entity.params.currentHp = health;
}

private getEntity(id: number | string): IMultiplayerEntity | null {
Expand Down
7 changes: 4 additions & 3 deletions src/multiplayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class Multiplayer {
Object.defineProperty(entity, 'face',
{ get() { return protectedFace; }, set() {console.log('tried to maniplulate face'); } });

let protectedState = simplify.getCurrentState(entity);
let protectedState = entity.currentState;
Object.defineProperty(entity, 'currentState', {
get() { return protectedState; },
set(data) { if (data.protected) { protectedState = data.protected; } },
Expand Down Expand Up @@ -260,9 +260,10 @@ export class Multiplayer {

private launchGame(): void {
// Remove title screen interact.
const buttonInteract = ig.gui.menues[15].children[2].buttonInteract; // TODO Resolve buttonInteract
// const buttonInteract = ig.gui.menues[15].children[2].buttonInteract; // TODO Resolve buttonInteract
// ig.interact.removeEntry(buttonInteract);

ig.interact.removeEntry(buttonInteract);
ig.interact.removeEntry(ig.interact.entries[0]);
ig.bgm.clear('MEDIUM_OUT'); // Clear BGM
ig.game.start(); // Start the game in story mode.
}
Expand Down

0 comments on commit b749ba5

Please sign in to comment.