24 lines
657 B
Python
24 lines
657 B
Python
# for type hints (predecessor)
|
|
from __future__ import annotations
|
|
|
|
from .mine import Mine
|
|
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):
|
|
if self.predecessor is None or not self.predecessor.active:
|
|
return super().disarm(wire)
|
|
|
|
else:
|
|
self.active = False
|
|
return False
|
|
|
|
def investigate(self):
|
|
return super().investigate()
|