Skip to main content

ModInstance

See the code at resources/mod_instance.gd

Description

Inherits Object

The ModInstance class represents an instance of a mod granted to an object in the Mod System. It contains references to the mod, the object it is granted to, and the instance script associated with the mod.


Properties

mod

var mod: Mod

The mod associated with this instance.

TypeMod
Defaultnull }

owner

var owner: Object

The object to which the mod is granted.

TypeObject
Defaultnull }

instance_script

var instance_script: ModInstanceScript

The script to be run when the mod is granted to the owner.

TypeModInstanceScript
Defaultnull }

Methods

_init

func _init(mod_value: Mod, owner_value: Object) -> void

Initializes the mod instance with the associated mod and mod owner. The mod's Mod.instance_script is also instantiated.

Parameters

NameTypeDescription
instance_valueModInstanceThe mod instance associated with this script.

Returns

void


grant

func grant() -> void

Grants the mod to the owner. This method executes the instance script and performs any necessary setup or modifications on the owner.

Returns

void


revoke

func revoke() -> void

Revokes the mod from the owner.

Returns

void