Remove gameplay monkeypatch wrapper
This commit is contained in:
parent
7bd730816a
commit
98d2c799b4
@ -1,28 +1 @@
|
||||
import Phaser from 'phaser';
|
||||
|
||||
const originalRestart = Phaser.Scenes.ScenePlugin.prototype.restart;
|
||||
Phaser.Scenes.ScenePlugin.prototype.restart = function restartWithFreshRunState(data) {
|
||||
const scene = this.scene;
|
||||
|
||||
if (scene?.sys?.settings?.key === 'game') {
|
||||
scene.playerSpeed = 0;
|
||||
scene.playerHull = 100;
|
||||
scene.gameState = 'playing';
|
||||
scene.lastPlayerShot = 0;
|
||||
scene.wave = 1;
|
||||
scene.defeated = 0;
|
||||
}
|
||||
|
||||
return originalRestart.call(this, data);
|
||||
};
|
||||
|
||||
const originalSetData = Phaser.GameObjects.GameObject.prototype.setData;
|
||||
Phaser.GameObjects.GameObject.prototype.setData = function setBalancedDamage(key, value) {
|
||||
if (key === 'damage' && this.texture?.key === 'pirate-shot') {
|
||||
value = Math.min(Number(value) || 0, 4);
|
||||
}
|
||||
|
||||
return originalSetData.call(this, key, value);
|
||||
};
|
||||
|
||||
await import('./game-v4.js');
|
||||
import './game-v4.js';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user