mirror of
https://github.com/Steffo99/lihzahrd.git
synced 2024-11-21 23:54:23 +00:00
Use slots for faster access
This commit is contained in:
parent
740577f578
commit
57378bfbaa
6 changed files with 12 additions and 1 deletions
|
@ -4,6 +4,8 @@ from .frameimportantdata import FrameImportantData
|
||||||
|
|
||||||
|
|
||||||
class Block:
|
class Block:
|
||||||
|
__slots__ = "type", "frame", "paint", "is_active"
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
type_: BlockType,
|
type_: BlockType,
|
||||||
frame: typing.Optional[FrameImportantData],
|
frame: typing.Optional[FrameImportantData],
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
class FrameImportantData:
|
class FrameImportantData:
|
||||||
|
__slots__ = "frame_x", "frame_y"
|
||||||
|
|
||||||
def __init__(self, frame_x, frame_y):
|
def __init__(self, frame_x, frame_y):
|
||||||
self.frame_x: int = frame_x
|
self.frame_x: int = frame_x
|
||||||
self.frame_y: int = frame_y
|
self.frame_y: int = frame_y
|
||||||
|
|
|
@ -2,6 +2,8 @@ from .liquidtype import LiquidType
|
||||||
|
|
||||||
|
|
||||||
class Liquid:
|
class Liquid:
|
||||||
|
__slots__ = "type", "volume"
|
||||||
|
|
||||||
def __init__(self, type_: LiquidType, volume: int):
|
def __init__(self, type_: LiquidType, volume: int):
|
||||||
self.type: LiquidType = type_
|
self.type: LiquidType = type_
|
||||||
self.volume: int = volume
|
self.volume: int = volume
|
||||||
|
|
|
@ -5,6 +5,7 @@ from .liquid import Liquid
|
||||||
|
|
||||||
|
|
||||||
class Tile:
|
class Tile:
|
||||||
|
__slots__ = "block", "wall", "liquid"
|
||||||
|
|
||||||
def __init__(self, block: typing.Optional[Block], wall: typing.Optional[Wall], liquid: typing.Optional[Liquid]):
|
def __init__(self, block: typing.Optional[Block], wall: typing.Optional[Wall], liquid: typing.Optional[Liquid]):
|
||||||
self.block: typing.Optional[Block] = block
|
self.block: typing.Optional[Block] = block
|
||||||
|
|
|
@ -3,6 +3,8 @@ from .walltype import WallType
|
||||||
|
|
||||||
|
|
||||||
class Wall:
|
class Wall:
|
||||||
|
__slots__ = "type", "paint"
|
||||||
|
|
||||||
def __init__(self, type_: WallType, paint: typing.Optional[int]):
|
def __init__(self, type_: WallType, paint: typing.Optional[int]):
|
||||||
self.type: WallType = type_
|
self.type: WallType = type_
|
||||||
self.paint: typing.Optional[int] = paint
|
self.paint: typing.Optional[int] = paint
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
class Wires:
|
class Wires:
|
||||||
|
__slots__ = "red", "green", "blue", "yellow", "actuator"
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
red: bool = False,
|
red: bool = False,
|
||||||
green: bool = False,
|
green: bool = False,
|
||||||
|
|
Loading…
Reference in a new issue