diff --git a/evennia/__init__.py b/evennia/__init__.py index 9ce1fa0ccf..01bbb1ee47 100644 --- a/evennia/__init__.py +++ b/evennia/__init__.py @@ -23,7 +23,7 @@ DefaultCharacter = None DefaultRoom = None DefaultExit = None DefaultChannel = None -Script = None +DefaultScript = None # Database models ObjectDB = None @@ -92,7 +92,7 @@ def init(): return __import__(mod, fromlist=[fromlist]) global DefaultPlayer, DefaultObject, DefaultGuest, DefaultCharacter, \ - DefaultRoom, DefaultExit, DefaultChannel, Script + DefaultRoom, DefaultExit, DefaultChannel, DefaultScript global ObjectDB, PlayerDB, ScriptDB, ChannelDB, Msg global Command, CmdSet, default_cmds, syscmdkeys global search_object, search_script, search_player, search_channel, search_help @@ -107,7 +107,7 @@ def init(): from objects.objects import DefaultRoom from objects.objects import DefaultExit from comms.comms import DefaultChannel - from scripts.scripts import Script + from scripts.scripts import DefaultScript # Database models from objects.models import ObjectDB diff --git a/evennia/contrib/tutorial_examples/bodyfunctions.py b/evennia/contrib/tutorial_examples/bodyfunctions.py index c15024338f..b566400b28 100644 --- a/evennia/contrib/tutorial_examples/bodyfunctions.py +++ b/evennia/contrib/tutorial_examples/bodyfunctions.py @@ -12,9 +12,9 @@ or you won't see any messages! """ import random -from evennia import Script +from evennia import DefaultScript -class BodyFunctions(Script): +class BodyFunctions(DefaultScript): """ This class defines the script itself """ diff --git a/evennia/contrib/tutorial_examples/red_button_scripts.py b/evennia/contrib/tutorial_examples/red_button_scripts.py index b73287c5c8..8cc3bb9755 100644 --- a/evennia/contrib/tutorial_examples/red_button_scripts.py +++ b/evennia/contrib/tutorial_examples/red_button_scripts.py @@ -6,7 +6,7 @@ red_button object type in contrib/examples. A few variations on uses of scripts are included. """ -from evennia import Script +from evennia import DefaultScript from contrib.tutorial_examples import cmdset_red_button as cmdsetexamples # @@ -26,7 +26,7 @@ from contrib.tutorial_examples import cmdset_red_button as cmdsetexamples # a bright light. The last one also has a timer component that allows it # to remove itself after a while (and the player recovers their eyesight). -class ClosedLidState(Script): +class ClosedLidState(DefaultScript): """ This manages the cmdset for the "closed" button state. What this means is that while this script is valid, we add the RedButtonClosed @@ -62,7 +62,7 @@ class ClosedLidState(Script): self.obj.cmdset.delete(cmdsetexamples.LidClosedCmdSet) -class OpenLidState(Script): +class OpenLidState(DefaultScript): """ This manages the cmdset for the "open" button state. This will add the RedButtonOpen @@ -97,7 +97,7 @@ class OpenLidState(Script): self.obj.cmdset.delete(cmdsetexamples.LidOpenCmdSet) -class BlindedState(Script): +class BlindedState(DefaultScript): """ This is a timed state. @@ -152,7 +152,7 @@ class BlindedState(Script): # that makes the lid covering the button slide back after a while. # -class CloseLidEvent(Script): +class CloseLidEvent(DefaultScript): """ This event closes the glass lid over the button some time after it was opened. It's a one-off @@ -195,7 +195,7 @@ class CloseLidEvent(Script): """ self.obj.close_lid() -class BlinkButtonEvent(Script): +class BlinkButtonEvent(DefaultScript): """ This timed script lets the button flash at regular intervals. """ @@ -225,7 +225,7 @@ class BlinkButtonEvent(Script): """ self.obj.blink() -class DeactivateButtonEvent(Script): +class DeactivateButtonEvent(DefaultScript): """ This deactivates the button for a short while (it won't blink, won't close its lid etc). It is meant to be called when the button is pushed diff --git a/evennia/contrib/tutorial_world/scripts.py b/evennia/contrib/tutorial_world/scripts.py index 0729a1ca68..b63a68ea63 100644 --- a/evennia/contrib/tutorial_world/scripts.py +++ b/evennia/contrib/tutorial_world/scripts.py @@ -3,7 +3,7 @@ This defines some generally useful scripts for the tutorial world. """ import random -from evennia import Script +from evennia import DefaultScript #------------------------------------------------------------ @@ -18,7 +18,7 @@ from evennia import Script # #------------------------------------------------------------ -class IrregularEvent(Script): +class IrregularEvent(DefaultScript): """ This script, which should be tied to a particular object upon instantiation, calls update_irregular on the object at random @@ -88,7 +88,7 @@ class FastIrregularEvent(IrregularEvent): # RESET_SUBSCRIBERS = ["examples.tutorial_world.p_weapon_rack", # "examples.tutorial_world.p_mob"] -# class EventResetTutorialWorld(Script): +# class EventResetTutorialWorld(DefaultScript): # """ # This calls the reset function on all subscribed objects # """ diff --git a/evennia/game_template/typeclasses/scripts.py b/evennia/game_template/typeclasses/scripts.py index 23250d55f8..5814f4795a 100644 --- a/evennia/game_template/typeclasses/scripts.py +++ b/evennia/game_template/typeclasses/scripts.py @@ -12,10 +12,10 @@ just overloads its hooks to have it perform its function. """ -from evennia import Script +from evennia import DefaultScript -class ExampleScript(Script): +class Script(DefaultScript): """ A script type is customized by redefining some or all of its hook methods and variables. diff --git a/evennia/players/bots.py b/evennia/players/bots.py index 936b4f19ec..7df6e315ac 100644 --- a/evennia/players/bots.py +++ b/evennia/players/bots.py @@ -6,7 +6,7 @@ Player that are controlled by the server. from django.conf import settings from evennia.players.players import DefaultPlayer -from evennia.scripts.scripts import Script +from evennia.scripts.scripts import DefaultScript from evennia.commands.command import Command from evennia.commands.cmdset import CmdSet from evennia.utils import search @@ -18,7 +18,7 @@ _SESSIONS = None # Bot helper utilities -class BotStarter(Script): +class BotStarter(DefaultScript): """ This non-repeating script has the sole purpose of kicking its bot diff --git a/evennia/scripts/scripts.py b/evennia/scripts/scripts.py index 9b477de15f..abf2b275cd 100644 --- a/evennia/scripts/scripts.py +++ b/evennia/scripts/scripts.py @@ -15,7 +15,7 @@ from evennia.scripts.manager import ScriptManager from evennia.comms import channelhandler from evennia.utils import logger -__all__ = ["Script", "DoNothing", "CheckSessions", +__all__ = ["DefaultScript", "DoNothing", "CheckSessions", "ValidateScripts", "ValidateChannelHandler"] _GA = object.__getattribute__ @@ -107,7 +107,7 @@ class ExtendedLoopingCall(LoopingCall): return None # -# Base script, inherit from Script below instead. +# Base script, inherit from DefaultScript below instead. # class ScriptBase(ScriptDB): """ @@ -346,7 +346,7 @@ class ScriptBase(ScriptDB): # Base Script - inherit from this # -class Script(ScriptBase): +class DefaultScript(ScriptBase): """ This is the base TypeClass for all Scripts. Scripts describe events, timers and states in game, they can have a time component or describe @@ -526,7 +526,7 @@ class Script(ScriptBase): # Some useful default Script types used by Evennia. -class DoNothing(Script): +class DoNothing(DefaultScript): "An script that does nothing. Used as default fallback." def at_script_creation(self): "Setup the script" @@ -534,7 +534,7 @@ class DoNothing(Script): self.desc = _("This is an empty placeholder script.") -class Store(Script): +class Store(DefaultScript): "Simple storage script" def at_script_creation(self): "Setup the script" @@ -542,7 +542,7 @@ class Store(Script): self.desc = _("This is a generic storage container.") -class CheckSessions(Script): +class CheckSessions(DefaultScript): "Check sessions regularly." def at_script_creation(self): "Setup the script" @@ -562,7 +562,7 @@ class CheckSessions(Script): _FLUSH_CACHE = None _IDMAPPER_CACHE_MAX_MEMORY = settings.IDMAPPER_CACHE_MAXSIZE -class ValidateIdmapperCache(Script): +class ValidateIdmapperCache(DefaultScript): """ Check memory use of idmapper cache """ @@ -579,7 +579,7 @@ class ValidateIdmapperCache(Script): from evennia.utils.idmapper.base import conditional_flush as _FLUSH_CACHE _FLUSH_CACHE(_IDMAPPER_CACHE_MAX_MEMORY) -class ValidateScripts(Script): +class ValidateScripts(DefaultScript): "Check script validation regularly" def at_script_creation(self): "Setup the script" @@ -594,7 +594,7 @@ class ValidateScripts(Script): ScriptDB.objects.validate() -class ValidateChannelHandler(Script): +class ValidateChannelHandler(DefaultScript): "Update the channelhandler to make sure it's in sync." def at_script_creation(self): "Setup the script" diff --git a/evennia/utils/gametime.py b/evennia/utils/gametime.py index 895be1e759..0c96a31ce6 100644 --- a/evennia/utils/gametime.py +++ b/evennia/utils/gametime.py @@ -8,7 +8,7 @@ total runtime of the server and the current uptime. from time import time from django.conf import settings -from evennia.scripts.scripts import Script +from evennia.scripts.scripts import DefaultScript from evennia.utils.create import create_script GAMETIME_SCRIPT_NAME = "sys_game_time" @@ -40,7 +40,7 @@ SERVER_STARTTIME = time() SERVER_RUNTIME = 0.0 -class GameTime(Script): +class GameTime(DefaultScript): """ This script repeatedly saves server times so it can be retrieved after server downtime.