This commit is contained in:
Ubuntu 2024-06-06 19:45:17 +05:30
parent d67551a303
commit 5ba4986d59
2403 changed files with 0 additions and 740883 deletions

View file

@ -1,38 +0,0 @@
# Released under the MIT License. See LICENSE for details.
#
"""Defines NodeActor class."""
from __future__ import annotations
from typing import TYPE_CHECKING
from ba._messages import DieMessage
from ba._actor import Actor
if TYPE_CHECKING:
import ba
from typing import Any
class NodeActor(Actor):
"""A simple ba.Actor type that wraps a single ba.Node.
Category: **Gameplay Classes**
This Actor will delete its Node when told to die, and it's
exists() call will return whether the Node still exists or not.
"""
def __init__(self, node: ba.Node):
super().__init__()
self.node = node
def handlemessage(self, msg: Any) -> Any:
if isinstance(msg, DieMessage):
if self.node:
self.node.delete()
return None
return super().handlemessage(msg)
def exists(self) -> bool:
return bool(self.node)