EnergyLink: cleanup the second
This commit is contained in:
parent
db152e6790
commit
68e9368bb3
|
@ -318,16 +318,17 @@ class CommonContext():
|
||||||
logger.info(f"DeathLink: Received from {data['source']}")
|
logger.info(f"DeathLink: Received from {data['source']}")
|
||||||
|
|
||||||
async def send_death(self, death_text: str = ""):
|
async def send_death(self, death_text: str = ""):
|
||||||
logger.info("DeathLink: Sending death to your friends...")
|
if self.server and self.server.socket:
|
||||||
self.last_death_link = time.time()
|
logger.info("DeathLink: Sending death to your friends...")
|
||||||
await self.send_msgs([{
|
self.last_death_link = time.time()
|
||||||
"cmd": "Bounce", "tags": ["DeathLink"],
|
await self.send_msgs([{
|
||||||
"data": {
|
"cmd": "Bounce", "tags": ["DeathLink"],
|
||||||
"time": self.last_death_link,
|
"data": {
|
||||||
"source": self.player_names[self.slot],
|
"time": self.last_death_link,
|
||||||
"cause": death_text
|
"source": self.player_names[self.slot],
|
||||||
}
|
"cause": death_text
|
||||||
}])
|
}
|
||||||
|
}])
|
||||||
|
|
||||||
async def update_death_link(self, death_link):
|
async def update_death_link(self, death_link):
|
||||||
old_tags = self.tags.copy()
|
old_tags = self.tags.copy()
|
||||||
|
|
|
@ -183,7 +183,7 @@ async def game_watcher(ctx: FactorioContext):
|
||||||
}]))
|
}]))
|
||||||
ctx.rcon_client.send_command(
|
ctx.rcon_client.send_command(
|
||||||
f"/ap-energylink -{value}")
|
f"/ap-energylink -{value}")
|
||||||
logger.info(f"EnergyLink: Sent {value} Joules")
|
logger.info(f"EnergyLink: Sent {Utils.format_SI_prefix(value)}J")
|
||||||
|
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
|
|
||||||
|
|
14
kvui.py
14
kvui.py
|
@ -91,9 +91,9 @@ class ServerToolTip(Label):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ServerLabel(HoverBehavior, Label):
|
class HovererableLabel(HoverBehavior, Label):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(ServerLabel, self).__init__(*args, **kwargs)
|
super(HovererableLabel, self).__init__(*args, **kwargs)
|
||||||
self.layout = FloatLayout()
|
self.layout = FloatLayout()
|
||||||
self.popuplabel = ServerToolTip(text="Test")
|
self.popuplabel = ServerToolTip(text="Test")
|
||||||
self.layout.add_widget(self.popuplabel)
|
self.layout.add_widget(self.popuplabel)
|
||||||
|
@ -105,6 +105,12 @@ class ServerLabel(HoverBehavior, Label):
|
||||||
def on_leave(self):
|
def on_leave(self):
|
||||||
App.get_running_app().root.remove_widget(self.layout)
|
App.get_running_app().root.remove_widget(self.layout)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def ctx(self) -> context_type:
|
||||||
|
return App.get_running_app().ctx
|
||||||
|
|
||||||
|
|
||||||
|
class ServerLabel(HovererableLabel):
|
||||||
def get_text(self):
|
def get_text(self):
|
||||||
if self.ctx.server:
|
if self.ctx.server:
|
||||||
ctx = self.ctx
|
ctx = self.ctx
|
||||||
|
@ -138,10 +144,6 @@ class ServerLabel(HoverBehavior, Label):
|
||||||
else:
|
else:
|
||||||
return "No current server connection. \nPlease connect to an Archipelago server."
|
return "No current server connection. \nPlease connect to an Archipelago server."
|
||||||
|
|
||||||
@property
|
|
||||||
def ctx(self) -> context_type:
|
|
||||||
return App.get_running_app().ctx
|
|
||||||
|
|
||||||
|
|
||||||
class MainLayout(GridLayout):
|
class MainLayout(GridLayout):
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue