forked from Team-Silver-Sphere/SquadJS
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29fc06e
commit fa31300
Showing
4 changed files
with
73 additions
and
0 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import BasePlugin from './base-plugin.js'; | ||
|
||
export default class FogOfWar extends BasePlugin { | ||
static get description() { | ||
return 'The <code>FogOfWar</code> plugin can be used to automate setting fog of war mode.'; | ||
} | ||
|
||
static get defaultEnabled() { | ||
return false; | ||
} | ||
|
||
static get optionsSpecification() { | ||
return { | ||
mode: { | ||
required: false, | ||
description: 'Fog of war mode to set.', | ||
default: 1 | ||
}, | ||
delay: { | ||
required: false, | ||
description: 'Delay before setting fog of war mode.', | ||
default: 10 * 1000 | ||
} | ||
}; | ||
} | ||
|
||
constructor(server, options, connectors) { | ||
super(server, options, connectors); | ||
|
||
this.onNewGame = this.onNewGame.bind(this); | ||
} | ||
|
||
async mount() { | ||
this.server.on('NEW_GAME', this.onNewGame); | ||
} | ||
|
||
async unmount() { | ||
this.server.removeEventListener('NEW_GAME', this.onNewGame); | ||
} | ||
|
||
async onNewGame() { | ||
setTimeout(() => { | ||
this.server.rcon.setFogOfWar(this.options.mode); | ||
}, this.options.delay); | ||
} | ||
} |
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