Projekt_Sztuczna_Inteligencja/objects/mine_models/chained_mine.py

24 lines
657 B
Python
Raw Normal View History

# for type hints (predecessor)
from __future__ import annotations
from .mine import Mine
2021-06-06 22:00:42 +02:00
from disarming.parameters.hash_function import TypeHash
class ChainedMine(Mine):
def __init__(self, position, predecessor: ChainedMine = None, active=True):
self.type = "chained"
self.predecessor = predecessor
super().__init__(TypeHash.CHAINED, position, active)
def disarm(self, wire):
2021-05-23 00:09:02 +02:00
if self.predecessor is None or not self.predecessor.active:
return super().disarm(wire)
2021-05-23 00:09:02 +02:00
else:
self.active = False
return False
def investigate(self):
return super().investigate()