e7299b17e9
Stack installed: - netfox v1.35.3 (core + extras + noray + internals) - godot-jolt v0.16.0-stable Architecture: - Server: ENet transport (works headless, no netfox deps) - Client/Editor: netfox rollback (RollbackSynchronizer, TickInterpolator) New/modified: - docs/migration-netfox-plan.md — migration architecture - scripts/network/network_manager.gd — netfox-aware ENet fallback - scripts/network/player.gd — clean base player - client/characters/player_netfox.gd — rollback player w/ WeaponManager - client/characters/input/player_net_input.gd — BaseNetInput subclass - client/characters/character/fps_character_controller.gd — netfox input feed - client/weapons/ — weapon data, registry, TacticalWeaponHitscan, WeaponManager - client/scripts/round_replicator.gd — client-side round state bridge - server/scripts/round_manager.gd — improved state machine - server/scripts/plugin_api/plugin_manager.gd — refined plugin system - config: enemy_tag, ally_tag for meatball targeting Removed: old C++ SimulationServer GDExtension (replaced by netfox rollback)
57 lines
1.4 KiB
Python
57 lines
1.4 KiB
Python
# Copyright Amethyst Reese
|
|
# Licensed under the MIT license
|
|
|
|
|
|
from collections.abc import Coroutine, Generator
|
|
from contextlib import AbstractAsyncContextManager
|
|
from functools import wraps
|
|
from typing import Any, Callable, TypeVar
|
|
|
|
from .cursor import Cursor
|
|
|
|
_T = TypeVar("_T")
|
|
|
|
|
|
class Result(AbstractAsyncContextManager[_T], Coroutine[Any, Any, _T]):
|
|
__slots__ = ("_coro", "_obj")
|
|
|
|
def __init__(self, coro: Coroutine[Any, Any, _T]):
|
|
self._coro = coro
|
|
self._obj: _T
|
|
|
|
def send(self, value) -> None:
|
|
return self._coro.send(value)
|
|
|
|
def throw(self, typ, val=None, tb=None) -> None:
|
|
if val is None:
|
|
return self._coro.throw(typ)
|
|
|
|
if tb is None:
|
|
return self._coro.throw(typ, val)
|
|
|
|
return self._coro.throw(typ, val, tb)
|
|
|
|
def close(self) -> None:
|
|
return self._coro.close()
|
|
|
|
def __await__(self) -> Generator[Any, None, _T]:
|
|
return self._coro.__await__()
|
|
|
|
async def __aenter__(self) -> _T:
|
|
self._obj = await self._coro
|
|
return self._obj
|
|
|
|
async def __aexit__(self, exc_type, exc, tb) -> None:
|
|
if isinstance(self._obj, Cursor):
|
|
await self._obj.close()
|
|
|
|
|
|
def contextmanager(
|
|
method: Callable[..., Coroutine[Any, Any, _T]],
|
|
) -> Callable[..., Result[_T]]:
|
|
@wraps(method)
|
|
def wrapper(self, *args, **kwargs) -> Result[_T]:
|
|
return Result(method(self, *args, **kwargs))
|
|
|
|
return wrapper
|