wmwpy.object_packs package

Submodules

wmwpy.object_packs.WMW module

class wmwpy.object_packs.WMW.fluidconverter(obj: Object | None = None)[source]

Bases: Type

NAME: str = 'fluidconverter'
PROPERTIES: dict[str, dict[Literal['type', 'default', 'options'], str | list[str]]] = {'ConverterType': {'default': 'static', 'options': ['dynamic', 'static'], 'type': 'string'}, 'FluidType': {'default': 'water', 'options': ['water', 'contaminatedwater', 'lava', 'steam', 'mud', 'drymud', 'wetmud'], 'type': 'string'}, 'FluidType#': {'default': 'water', 'options': ['water', 'contaminatedwater', 'lava', 'steam', 'mud', 'drymud', 'wetmud'], 'type': 'string'}, 'MaskSpriteIndex': {'default': '1', 'type': 'int'}, 'OutlineSpriteIndex': {'default': '2', 'type': 'int'}, 'StartingFluidType': {'default': 'water', 'options': ['water', 'contaminatedwater', 'lava', 'steam', 'mud', 'drymud', 'wetmud'], 'type': 'string'}}
ready_properties()[source]

Ready the properties before they are put into the level xml. By default, properties that are equal to their default property counterpart are removed, except ‘Type’, ‘Angle’, and ‘Filename’.

Parameters:

include (list[str], optional) – List of properties to always keep. Defaults to [].

Returns:

The new properties.

Return type:

dict[str,str]

To use this inside a custom Type, just call the super() with the include argument.

from wmwpy.classes.objectpacks import Type

class fluidconverter(Type):
    NAME = 'fluidconverter'

    def ready_properties(self):
        return super().ready_properties(include = [
            'FluidType',
            'FluidType#',
            'StartingFluidType',
            'ConverterType',
        ])
ready_sprites()[source]

Get the sprites ready for generating the object image.

In this method, you can modify any object or sprites properties to generate the correct image based on the object properties. There are also many methods that can be used to make the process easier.

from wmwpy.classes.objectpacks import Type

class yswitch(Type):
    NAME = 'yswitch'

    def ready_sprites(self):
        YSwitchPosition = self.get_property('YSwitchPosition')

        ToggleSpriteIndex = self.get_property('ToggleSpriteIndex')

        if YSwitchPosition != 1:
            YSwitchPosition = 0

        self.obj.sprites[ToggleSpriteIndex].angle = (360 / -3) * (YSwitchPosition + 1)

You can also modify sprite images directly.

from wmwpy.classes.objectpacks import Type
from wmwpy.utils import imageprocessing

class star(Type):
    NAME = 'star'

    def ready_sprites(self):
        StarType = self.get_property('StarType').lower()

        if StarType == 'note':
            color = tuple(self.get_property('Color'))

            try:
                self.obj.sprites[2].image = imageprocessing.recolor_image(
                    self.obj.sprites[2].image,
                    color
                )
            except:
                pass
class wmwpy.object_packs.WMW.spout(obj: Object | None = None)[source]

Bases: Type

NAME: str = 'spout'
PROPERTIES: dict[str, dict[Literal['type', 'default', 'options'], str | list[str]]] = {'Absorber': {'default': '0', 'type': 'bit'}, 'AngleVariation': {'default': '0', 'type': 'int'}, 'Blockable': {'default': '1', 'type': 'bit'}, 'ConnectedConverter': {'default': 'FluidConerter0', 'type': 'string'}, 'ConnectedSpout#': {'default': 'Spout0', 'type': 'string'}, 'ConnectedSpoutProbability#': {'default': '1', 'type': 'float'}, 'ConnectedYSwitchPort#': {'default': 'left', 'options': ['left', 'right'], 'type': 'string'}, 'ExplusionAngleVariation': {'default': '2', 'type': 'int'}, 'ExpulsionAngle': {'default': '0.0', 'type': 'float'}, 'ExpulsionAngleVariation': {'default': '0.0', 'type': 'float'}, 'FluidType': {'default': 'water', 'options': ['water', 'contaminatedwater', 'lava', 'steam', 'mud', 'drymud', 'wetmud'], 'type': 'string'}, 'Goal': {'default': '0', 'type': 'bit'}, 'GoalPreset': {'default': 'Swampy', 'options': ['Swampy', 'Cranky', 'Allie'], 'type': 'string'}, 'IsMysterious': {'default': '1', 'type': 'bit'}, 'Limit': {'default': '60', 'type': 'int'}, 'Mute': {'default': '0', 'type': 'bit'}, 'NoCutHole': {'default': '0', 'type': 'bit'}, 'NumParticles': {'default': '1', 'type': 'int'}, 'NumberParticles': {'default': '-1', 'type': 'float'}, 'OffsetToBlock': {'default': '0 0', 'type': 'float float'}, 'OffsetToMouth': {'default': '0 0', 'type': 'float float'}, 'OffsetVariation': {'default': '0.0', 'type': 'float'}, 'ParticleCount': {'default': '0', 'type': 'int'}, 'ParticleDryness': {'default': '0', 'type': 'float'}, 'ParticleOffset': {'default': '0 0', 'type': 'float float'}, 'ParticlePerSecond': {'default': '-1', 'type': 'int'}, 'ParticlePerSeconds': {'default': '15', 'type': 'int'}, 'ParticleQueueThreshhold': {'default': '0', 'type': 'int'}, 'ParticleQueueThreshold': {'default': '0', 'type': 'int'}, 'ParticleSpeed': {'default': '1', 'type': 'float'}, 'ParticleVariation': {'default': '0', 'type': 'int'}, 'ParticlesPerSecond': {'default': '3', 'type': 'float'}, 'ParticlesQueueThreshold': {'default': '0', 'type': 'int'}, 'ParticlesSpeed': {'default': '0', 'type': 'int'}, 'ParticplesPerSecond': {'default': '15', 'type': 'int'}, 'PartilcesPerSecond': {'default': '5', 'type': 'int'}, 'PerticlesPerSecond': {'default': '15', 'type': 'int'}, 'SpoutType': {'default': 'OpenSpout', 'options': ['Drain', 'TouchSpout', 'OpenSpout', 'DrainSpout'], 'type': 'string'}, 'SprinklerSteps': {'default': '4', 'type': 'int'}, 'SprinklerWidth': {'default': '1', 'type': 'float'}, 'Timer#': {'default': '1 1', 'type': 'bit float'}, 'VacuumBaseAngle': {'default': '90', 'type': 'int'}, 'VacuumCenterOffsetA': {'default': '0 0', 'type': 'int int'}, 'VacuumCenterOffsetB': {'default': '0 0', 'type': 'int int'}, 'VacuumForce': {'default': '100', 'type': 'int'}, 'VacuumFriction': {'default': '0', 'type': 'float'}, 'VacuumMaxAngle': {'default': '0', 'type': 'int'}, 'VacuumMaxD': {'default': '80', 'type': 'int'}, 'VacuumMaxForce': {'default': '80', 'type': 'int'}, 'VacuumMinAngle': {'default': '0', 'type': 'int'}, 'VacuumOn': {'default': '0', 'type': 'bit'}, 'VacuumRaycastOffset': {'default': '0', 'type': 'float'}, 'ValveIndex': {'default': '1', 'type': 'bit'}, 'particlespersecond': {'default': '3', 'type': 'int'}, 'xParticleQueueThreshold': {'default': '0', 'type': 'int'}}
ready_properties()[source]

Ready the properties before they are put into the level xml. By default, properties that are equal to their default property counterpart are removed, except ‘Type’, ‘Angle’, and ‘Filename’.

Parameters:

include (list[str], optional) – List of properties to always keep. Defaults to [].

Returns:

The new properties.

Return type:

dict[str,str]

To use this inside a custom Type, just call the super() with the include argument.

from wmwpy.classes.objectpacks import Type

class fluidconverter(Type):
    NAME = 'fluidconverter'

    def ready_properties(self):
        return super().ready_properties(include = [
            'FluidType',
            'FluidType#',
            'StartingFluidType',
            'ConverterType',
        ])
class wmwpy.object_packs.WMW.star(obj: Object | None = None)[source]

Bases: Type

NAME: str = 'star'
PROPERTIES: dict[str, dict[Literal['type', 'default', 'options'], str | list[str]]] = {'AllowCollect': {'default': '1', 'type': 'bit'}, 'AllowedFluid': {'default': 'water', 'options': ['water', 'contaminatedwater', 'lava', 'steam', 'mud', 'drymud', 'wetmud'], 'type': 'string'}, 'BlastRadius': {'default': '7.5', 'type': 'float'}, 'Burst': {'default': '0', 'type': 'bit'}, 'Color': {'default': '255 255 255 255', 'options': ['150 198 232 255', '195 214 0 255', '183 52 52 255', '209 85 174 255', '237 158 64 255', '107 53 146 255'], 'type': 'int int int int'}, 'CutRadius': {'default': '5', 'type': 'float'}, 'CutsDirt': {'default': '1', 'type': 'bit'}, 'CutsRock': {'default': '0', 'type': 'bit'}, 'FillDirection': {'default': 'up', 'options': ['up', 'down'], 'type': 'string'}, 'FillTexture': {'default': 'none', 'type': 'string'}, 'IgnoreFluid': {'default': 'steam', 'options': ['water', 'contaminatedwater', 'lava', 'steam', 'mud', 'drymud', 'wetmud'], 'type': 'string'}, 'IsSponge': {'default': '0', 'type': 'bit'}, 'NumParticlesToHatch': {'default': '5', 'type': 'int'}, 'Order': {'default': '0', 'type': 'int'}, 'PlatinumType': {'default': 'normal', 'options': ['platinum', 'note', 'normal'], 'type': 'string'}, 'StarType': {'default': 'normal', 'options': ['normal', 'allie', 'baby', 'teleport', 'note', 'mega'], 'type': 'string'}, 'TeleportMoveEase': {'default': 'both', 'options': ['both', 'in', 'out'], 'type': 'string'}, 'TeleportMoveTime': {'default': '0', 'type': 'float'}, 'TeleportWaitTime': {'default': '0', 'type': 'float'}}
ready_properties() dict[str, str][source]

Ready the properties before they are put into the level xml. By default, properties that are equal to their default property counterpart are removed, except ‘Type’, ‘Angle’, and ‘Filename’.

Parameters:

include (list[str], optional) – List of properties to always keep. Defaults to [].

Returns:

The new properties.

Return type:

dict[str,str]

To use this inside a custom Type, just call the super() with the include argument.

from wmwpy.classes.objectpacks import Type

class fluidconverter(Type):
    NAME = 'fluidconverter'

    def ready_properties(self):
        return super().ready_properties(include = [
            'FluidType',
            'FluidType#',
            'StartingFluidType',
            'ConverterType',
        ])
ready_sprites()[source]

Get the sprites ready for generating the object image.

In this method, you can modify any object or sprites properties to generate the correct image based on the object properties. There are also many methods that can be used to make the process easier.

from wmwpy.classes.objectpacks import Type

class yswitch(Type):
    NAME = 'yswitch'

    def ready_sprites(self):
        YSwitchPosition = self.get_property('YSwitchPosition')

        ToggleSpriteIndex = self.get_property('ToggleSpriteIndex')

        if YSwitchPosition != 1:
            YSwitchPosition = 0

        self.obj.sprites[ToggleSpriteIndex].angle = (360 / -3) * (YSwitchPosition + 1)

You can also modify sprite images directly.

from wmwpy.classes.objectpacks import Type
from wmwpy.utils import imageprocessing

class star(Type):
    NAME = 'star'

    def ready_sprites(self):
        StarType = self.get_property('StarType').lower()

        if StarType == 'note':
            color = tuple(self.get_property('Color'))

            try:
                self.obj.sprites[2].image = imageprocessing.recolor_image(
                    self.obj.sprites[2].image,
                    color
                )
            except:
                pass
class wmwpy.object_packs.WMW.waterballoon(obj: Object | None = None)[source]

Bases: Type

NAME: str = 'waterballoon'
PROPERTIES: dict[str, dict[Literal['type', 'default', 'options'], str | list[str]]] = {'AttachVertIndex': {'default': '6', 'type': 'int'}, 'CollisionElasticityWorld': {'default': '0.05', 'type': 'float'}, 'CollisionFrictionWorld': {'default': '0.2', 'type': 'float'}, 'ConnectedSpout': {'default': 'Spout0', 'type': 'string'}, 'ContaminatedSpriteIndex': {'default': '1', 'type': 'bit'}, 'EdgeSpringDamping': {'default': '1', 'type': 'int'}, 'EdgeSpringK': {'default': '500', 'type': 'int'}, 'InitialParticles': {'default': 'water 10', 'options': ['water', 'contaminatedwater', 'lava', 'steam', 'mud', 'drymud', 'wetmud'], 'type': 'string int ...'}, 'InternalSpring#': {'default': '1 5 500 10', 'options': ['1 5 500 10', '8 0 500 10', '7 11 500 10', '11 3 500 10', '0 4 500 10', '4 8 500 10', '9 1 500 10', '2 6 500 10', '10 2 500 10', '3 7 500 10', '5 9 500 10', '6 10 500 10'], 'type': 'int int int int'}, 'MaxParticles': {'default': '70', 'type': 'int'}, 'MouthSpriteIndex': {'default': '3', 'type': 'int'}, 'MudSpriteIndex': {'default': '4', 'type': 'int'}, 'ParticleDryness': {'default': '1.0', 'type': 'float'}, 'PointMass': {'default': '1', 'type': 'float'}, 'ShapeMatchingDamping': {'default': '500', 'type': 'int'}, 'ShapeMatchingK': {'default': '500', 'type': 'int'}, 'SteamSpriteIndex': {'default': '2', 'type': 'int'}}
ready_sprites()[source]

Get the sprites ready for generating the object image.

In this method, you can modify any object or sprites properties to generate the correct image based on the object properties. There are also many methods that can be used to make the process easier.

from wmwpy.classes.objectpacks import Type

class yswitch(Type):
    NAME = 'yswitch'

    def ready_sprites(self):
        YSwitchPosition = self.get_property('YSwitchPosition')

        ToggleSpriteIndex = self.get_property('ToggleSpriteIndex')

        if YSwitchPosition != 1:
            YSwitchPosition = 0

        self.obj.sprites[ToggleSpriteIndex].angle = (360 / -3) * (YSwitchPosition + 1)

You can also modify sprite images directly.

from wmwpy.classes.objectpacks import Type
from wmwpy.utils import imageprocessing

class star(Type):
    NAME = 'star'

    def ready_sprites(self):
        StarType = self.get_property('StarType').lower()

        if StarType == 'note':
            color = tuple(self.get_property('Color'))

            try:
                self.obj.sprites[2].image = imageprocessing.recolor_image(
                    self.obj.sprites[2].image,
                    color
                )
            except:
                pass
class wmwpy.object_packs.WMW.yswitch(obj: Object | None = None)[source]

Bases: Type

NAME: str = 'yswitch'
PROPERTIES: dict[str, dict[Literal['type', 'default', 'options'], str | list[str]]] = {'ConnectedConverter': {'default': 'FluidConverter0', 'type': 'string'}, 'ConnectedSpout#': {'default': 'Spout0', 'type': 'string'}, 'ConnectedSpoutProbability#': {'default': '1', 'type': 'float'}, 'FirstLeftSpout': {'default': '1', 'type': 'bit'}, 'FirstRightSpout': {'default': '0', 'type': 'int'}, 'PlugSpriteIndex': {'default': '3', 'type': 'int'}, 'ToggleSpriteIndex': {'default': '1', 'type': 'int'}, 'WindowSpriteIndex': {'default': '2', 'type': 'int'}, 'YSwitchPosition': {'default': '0', 'type': 'bit'}}
ready_sprites()[source]

Get the sprites ready for generating the object image.

In this method, you can modify any object or sprites properties to generate the correct image based on the object properties. There are also many methods that can be used to make the process easier.

from wmwpy.classes.objectpacks import Type

class yswitch(Type):
    NAME = 'yswitch'

    def ready_sprites(self):
        YSwitchPosition = self.get_property('YSwitchPosition')

        ToggleSpriteIndex = self.get_property('ToggleSpriteIndex')

        if YSwitchPosition != 1:
            YSwitchPosition = 0

        self.obj.sprites[ToggleSpriteIndex].angle = (360 / -3) * (YSwitchPosition + 1)

You can also modify sprite images directly.

from wmwpy.classes.objectpacks import Type
from wmwpy.utils import imageprocessing

class star(Type):
    NAME = 'star'

    def ready_sprites(self):
        StarType = self.get_property('StarType').lower()

        if StarType == 'note':
            color = tuple(self.get_property('Color'))

            try:
                self.obj.sprites[2].image = imageprocessing.recolor_image(
                    self.obj.sprites[2].image,
                    color
                )
            except:
                pass

Module contents

wmwpy.object_packs.get_object_pack(name: str = 'WMW') ObjectPack | None[source]
wmwpy.object_packs.register_object_pack(name: str, pack: ObjectPack)[source]