-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SRV] refact(ScriptEngine): add abstract layer to scripts between Eng…
…ine and GameLogic Now any Python IDE should detect exist wraps of exported objects and provide auto-indentation. Engine_Geometry left without wraps for now. Also documentation wasn't added yet.
- Loading branch information
Showing
23 changed files
with
421 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from Engine.Server import Player | ||
from Objects.Creatures.Ghost import Ghostize | ||
|
||
def OnPlayerJoined(player: Player): | ||
print(player.ckey + " has joined! Yay!") | ||
player.AddVerb("ghost", Ghostize) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from Engine.Hooks import * | ||
|
||
def rawOnPlayerJoined(player): | ||
OnPlayerJoined(Player(player)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from Engine_Server import * | ||
from Engine.World import World, Control | ||
|
||
from enum import Enum | ||
|
||
class Game(eGame): | ||
def __new__(cls, parent): | ||
return parent | ||
|
||
@property | ||
def world() -> World: | ||
return World(eGGame.world) | ||
|
||
|
||
class Player(ePlayer): | ||
def __new__(cls, parent): | ||
return parent | ||
|
||
@property | ||
def ckey(self) -> str: | ||
return super().ckey | ||
|
||
@property | ||
def control(self) -> Control: | ||
return Control(super().control) | ||
|
||
@control.setter | ||
def control(self, value): | ||
super(Player, self.__class__).control.fset(self, value) | ||
|
||
def IsConnected(self) -> bool: | ||
return super().IsConnected() | ||
|
||
|
||
class ResourceManager(eResourceManager): | ||
def __new__(cls, parent): | ||
return parent | ||
|
||
def GetIcon(title, state) -> eIcon: | ||
eGServer.RM.GetIcon(title, state) | ||
|
||
|
||
gServer = eGServer | ||
gGame = Game(eGGame) | ||
gRM = ResourceManager(eGServer.RM) | ||
|
||
|
||
class ItemSpriteState(eItemSpriteState): | ||
DEFAULT = eItemSpriteState.DEFAULT | ||
ON_MOB = eItemSpriteState.ON_MOB | ||
IN_HAND_LEFT = eItemSpriteState.IN_HAND_LEFT | ||
IN_HAND_RIGHT = eItemSpriteState.IN_HAND_RIGHT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import contextlib | ||
from datetime import timedelta | ||
from typing import Callable | ||
|
||
from Engine_Server import eGGame | ||
|
||
def spawn(delay: timedelta, activity: Callable[[], None]) -> None: | ||
eGGame.AddDelayedActivity(delay, activity) |
Oops, something went wrong.