mirror of
https://github.com/Steffo99/lihzahrd.git
synced 2024-11-21 15:44:24 +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,
|
||||
type_: BlockType,
|
||||
frame: typing.Optional[FrameImportantData],
|
||||
shape: Shape,
|
||||
paint: typing.Optional[int],
|
||||
shape: Shape = Shape.NORMAL,
|
||||
frame: typing.Optional[FrameImportantData] = None,
|
||||
paint: typing.Optional[int] = None,
|
||||
is_active: bool = True):
|
||||
self.type: BlockType = type_
|
||||
"""The type of the block (dirt, stone, ...)."""
|
||||
|
@ -22,6 +22,7 @@ class Block:
|
|||
"""The framedata of the block, if present."""
|
||||
|
||||
self.shape: Shape = shape
|
||||
"""The shape of the block, is changed with an hammer."""
|
||||
|
||||
self.paint: typing.Optional[int] = paint
|
||||
"""The paint color of a block."""
|
||||
|
|
|
@ -6,7 +6,7 @@ class Liquid:
|
|||
|
||||
__slots__ = "type", "volume"
|
||||
|
||||
def __init__(self, type_: LiquidType, volume: int):
|
||||
def __init__(self, type_: LiquidType, volume: int = 255):
|
||||
self.type: LiquidType = type_
|
||||
"""The type of liquid present in the tile."""
|
||||
|
||||
|
|
|
@ -11,10 +11,13 @@ class Tile:
|
|||
__slots__ = "block", "wall", "liquid", "wiring"
|
||||
|
||||
def __init__(self,
|
||||
block: typing.Optional[Block],
|
||||
wall: typing.Optional[Wall],
|
||||
liquid: typing.Optional[Liquid],
|
||||
wiring: Wiring):
|
||||
block: typing.Optional[Block] = None,
|
||||
wall: typing.Optional[Wall] = None,
|
||||
liquid: typing.Optional[Liquid] = None,
|
||||
wiring: Wiring = None):
|
||||
if wiring is None:
|
||||
wiring = Wiring()
|
||||
|
||||
self.block: typing.Optional[Block] = block
|
||||
self.wall: typing.Optional[Wall] = wall
|
||||
self.liquid: typing.Optional[Liquid] = liquid
|
||||
|
|
|
@ -7,6 +7,6 @@ class Wall:
|
|||
|
||||
__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.paint: typing.Optional[int] = paint
|
||||
|
|
Loading…
Reference in a new issue