-
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.
make health pack its own plugin, finish dep code
- Loading branch information
1 parent
14dc64d
commit ad45e54
Showing
9 changed files
with
789 additions
and
48 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
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,5 @@ | ||
// | ||
|
||
export const dependencies = { | ||
// "is-thirteen": "^2.0.0", | ||
}; |
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,58 @@ | ||
//basic | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
//plugin: samplecommand | ||
import { HealthPackItem } from './shared.js'; | ||
// | ||
|
||
export const PluginMeta = { | ||
identifier: "healthpackitem", | ||
name: 'Health Pack Item', | ||
author: 'onlypuppy7', | ||
version: '1.0.0', | ||
descriptionShort: 'Adds a new item type which regains 50hp on collection', //displayed when loading | ||
descriptionLong: 'Adds a new item type which regains 50hp on collection', | ||
legacyShellVersion: 324, //legacy shell version, can be found in /versionEnum.txt, or just on the homescreen | ||
}; | ||
|
||
export var pluginInstance = null; | ||
|
||
export class Plugin { | ||
constructor(plugins, thisDir) { | ||
this.plugins = plugins; | ||
this.thisDir = thisDir; | ||
|
||
pluginInstance = this; | ||
|
||
HealthPackItem.registerListeners(this.plugins); | ||
this.plugins.on('client:pluginSourceInsertion', this.pluginSourceInsertion.bind(this)); | ||
this.plugins.on('client:prepareBabylon', this.prepareBabylon.bind(this)); | ||
this.plugins.on('game:prepareBabylon', this.prepareBabylon.bind(this)); | ||
}; | ||
|
||
pluginSourceInsertion(data) { | ||
data.pluginInsertion.files.push({ | ||
insertBefore: '\nconsole.log("inserting before... (HealthPackItem)");', | ||
filepath: path.join(this.thisDir, 'shared.js'), | ||
insertAfter: '\nconsole.log("inserting after... (HealthPackItem)!");', | ||
position: 'before' | ||
}); | ||
}; | ||
|
||
async prepareBabylon(data) { | ||
// console.log('prepareBabylon', data.filename); | ||
var extraBabylons = data.extraBabylons; | ||
|
||
const babylonPath = path.join(this.thisDir, 'models'); | ||
const babylonFiles = fs.readdirSync(babylonPath); | ||
for (const file of babylonFiles) { | ||
if (data.filename + ".babylon" === file) { | ||
console.log('found', file); | ||
extraBabylons.push({ | ||
filepath: path.join(this.thisDir, 'models', file), | ||
overwrite: false, | ||
}); | ||
}; | ||
}; | ||
}; | ||
}; |
Oops, something went wrong.