1
mirror of https://github.com/thepeacockproject/Peacock synced 2024-11-22 22:12:45 +01:00

Fix documentation for addClientSideModDependency and add new modIsInstalled function with more sensible naming and semantics (#51)

* Fix documentation and add new function

Signed-off-by: atampy25 <24306974+atampy25@users.noreply.github.com>
Co-authored-by: Reece Dunham <me@rdil.rocks>
This commit is contained in:
atampy25 2022-12-03 13:33:14 +10:00 committed by GitHub
parent a86e27ce66
commit 9969168616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -427,11 +427,13 @@ export class Controller {
}
/**
* Adds a dependency on a client side mod through the Simple Mod Framework.
* See the cookbook for a usage example!
* You should use {@link modIsInstalled} instead!
*
* Returns whether a mod is UNAVAILABLE.
*
* @param modId The mod's ID.
* @returns If the mod is available. You will probably want to abort plugin initialization if false is returned.
* @returns If the mod is unavailable. You should probably abort initialization if true is returned. Also returns true if the `overrideFrameworkChecks` flag is set.
* @deprecated since v5.5.0
*/
public addClientSideModDependency(modId: string): boolean {
return (
@ -440,6 +442,19 @@ export class Controller {
)
}
/**
* Returns whether a mod is available and installed.
*
* @param modId The mod's ID.
* @returns If the mod is available (or the `overrideFrameworkChecks` flag is set). You should probably abort initialisation if false is returned.
*/
public modIsInstalled(modId: string): boolean {
return (
this.installedMods.includes(modId) ||
getFlag("overrideFrameworkChecks") === true
)
}
/**
* Starts the service and loads in all contracts.
*