mirror of
https://github.com/Steffo99/lihzahrd.git
synced 2024-11-21 23:54:23 +00:00
Add default arguments to tiles
This commit is contained in:
parent
392e17a4e2
commit
47b5c62533
4 changed files with 13 additions and 9 deletions
|
@ -11,9 +11,9 @@ class Block:
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
type_: BlockType,
|
type_: BlockType,
|
||||||
frame: typing.Optional[FrameImportantData],
|
shape: Shape = Shape.NORMAL,
|
||||||
shape: Shape,
|
frame: typing.Optional[FrameImportantData] = None,
|
||||||
paint: typing.Optional[int],
|
paint: typing.Optional[int] = None,
|
||||||
is_active: bool = True):
|
is_active: bool = True):
|
||||||
self.type: BlockType = type_
|
self.type: BlockType = type_
|
||||||
"""The type of the block (dirt, stone, ...)."""
|
"""The type of the block (dirt, stone, ...)."""
|
||||||
|
@ -22,6 +22,7 @@ class Block:
|
||||||
"""The framedata of the block, if present."""
|
"""The framedata of the block, if present."""
|
||||||
|
|
||||||
self.shape: Shape = shape
|
self.shape: Shape = shape
|
||||||
|
"""The shape of the block, is changed with an hammer."""
|
||||||
|
|
||||||
self.paint: typing.Optional[int] = paint
|
self.paint: typing.Optional[int] = paint
|
||||||
"""The paint color of a block."""
|
"""The paint color of a block."""
|
||||||
|
|
|
@ -6,7 +6,7 @@ class Liquid:
|
||||||
|
|
||||||
__slots__ = "type", "volume"
|
__slots__ = "type", "volume"
|
||||||
|
|
||||||
def __init__(self, type_: LiquidType, volume: int):
|
def __init__(self, type_: LiquidType, volume: int = 255):
|
||||||
self.type: LiquidType = type_
|
self.type: LiquidType = type_
|
||||||
"""The type of liquid present in the tile."""
|
"""The type of liquid present in the tile."""
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,13 @@ class Tile:
|
||||||
__slots__ = "block", "wall", "liquid", "wiring"
|
__slots__ = "block", "wall", "liquid", "wiring"
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
block: typing.Optional[Block],
|
block: typing.Optional[Block] = None,
|
||||||
wall: typing.Optional[Wall],
|
wall: typing.Optional[Wall] = None,
|
||||||
liquid: typing.Optional[Liquid],
|
liquid: typing.Optional[Liquid] = None,
|
||||||
wiring: Wiring):
|
wiring: Wiring = None):
|
||||||
|
if wiring is None:
|
||||||
|
wiring = Wiring()
|
||||||
|
|
||||||
self.block: typing.Optional[Block] = block
|
self.block: typing.Optional[Block] = block
|
||||||
self.wall: typing.Optional[Wall] = wall
|
self.wall: typing.Optional[Wall] = wall
|
||||||
self.liquid: typing.Optional[Liquid] = liquid
|
self.liquid: typing.Optional[Liquid] = liquid
|
||||||
|
|
|
@ -7,6 +7,6 @@ class Wall:
|
||||||
|
|
||||||
__slots__ = "type", "paint"
|
__slots__ = "type", "paint"
|
||||||
|
|
||||||
def __init__(self, type_: WallType, paint: typing.Optional[int]):
|
def __init__(self, type_: WallType, paint: typing.Optional[int] = None):
|
||||||
self.type: WallType = type_
|
self.type: WallType = type_
|
||||||
self.paint: typing.Optional[int] = paint
|
self.paint: typing.Optional[int] = paint
|
||||||
|
|
Loading…
Reference in a new issue