Added new files

This commit is contained in:
vortex 2024-02-20 23:04:51 +05:30
parent 867634cc5c
commit 3a407868d4
1775 changed files with 550222 additions and 0 deletions

38
dist/ba_data/python/ba/_nodeactor.py vendored Normal file
View file

@ -0,0 +1,38 @@
# 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)