2021-03-26 15:46:00 +01:00
|
|
|
# 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
|
2021-03-26 15:46:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
class ChainedMine(Mine):
|
|
|
|
def __init__(self, position, predecessor: ChainedMine = None, active=True):
|
|
|
|
self.type = "chained"
|
2021-05-23 20:20:02 +02:00
|
|
|
self.predecessor = predecessor
|
|
|
|
super().__init__(TypeHash.CHAINED, position, active)
|
2021-03-26 15:46:00 +01:00
|
|
|
|
2021-05-23 20:20:02 +02:00
|
|
|
def disarm(self, wire):
|
2021-05-23 00:09:02 +02:00
|
|
|
if self.predecessor is None or not self.predecessor.active:
|
2021-05-23 20:20:02 +02:00
|
|
|
return super().disarm(wire)
|
|
|
|
|
2021-05-23 00:09:02 +02:00
|
|
|
else:
|
2021-05-23 20:20:02 +02:00
|
|
|
return False
|
|
|
|
|
|
|
|
def investigate(self):
|
|
|
|
return super().investigate()
|