Changed Script to DefaultScript to be consistent with other default typeclasses.
This commit is contained in:
parent
a5156876b0
commit
bbb99a9c28
8 changed files with 30 additions and 30 deletions
|
|
@ -23,7 +23,7 @@ DefaultCharacter = None
|
||||||
DefaultRoom = None
|
DefaultRoom = None
|
||||||
DefaultExit = None
|
DefaultExit = None
|
||||||
DefaultChannel = None
|
DefaultChannel = None
|
||||||
Script = None
|
DefaultScript = None
|
||||||
|
|
||||||
# Database models
|
# Database models
|
||||||
ObjectDB = None
|
ObjectDB = None
|
||||||
|
|
@ -92,7 +92,7 @@ def init():
|
||||||
return __import__(mod, fromlist=[fromlist])
|
return __import__(mod, fromlist=[fromlist])
|
||||||
|
|
||||||
global DefaultPlayer, DefaultObject, DefaultGuest, DefaultCharacter, \
|
global DefaultPlayer, DefaultObject, DefaultGuest, DefaultCharacter, \
|
||||||
DefaultRoom, DefaultExit, DefaultChannel, Script
|
DefaultRoom, DefaultExit, DefaultChannel, DefaultScript
|
||||||
global ObjectDB, PlayerDB, ScriptDB, ChannelDB, Msg
|
global ObjectDB, PlayerDB, ScriptDB, ChannelDB, Msg
|
||||||
global Command, CmdSet, default_cmds, syscmdkeys
|
global Command, CmdSet, default_cmds, syscmdkeys
|
||||||
global search_object, search_script, search_player, search_channel, search_help
|
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 DefaultRoom
|
||||||
from objects.objects import DefaultExit
|
from objects.objects import DefaultExit
|
||||||
from comms.comms import DefaultChannel
|
from comms.comms import DefaultChannel
|
||||||
from scripts.scripts import Script
|
from scripts.scripts import DefaultScript
|
||||||
|
|
||||||
# Database models
|
# Database models
|
||||||
from objects.models import ObjectDB
|
from objects.models import ObjectDB
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ or you won't see any messages!
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import random
|
import random
|
||||||
from evennia import Script
|
from evennia import DefaultScript
|
||||||
|
|
||||||
class BodyFunctions(Script):
|
class BodyFunctions(DefaultScript):
|
||||||
"""
|
"""
|
||||||
This class defines the script itself
|
This class defines the script itself
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ red_button object type in contrib/examples. A few variations
|
||||||
on uses of scripts are included.
|
on uses of scripts are included.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from evennia import Script
|
from evennia import DefaultScript
|
||||||
from contrib.tutorial_examples import cmdset_red_button as cmdsetexamples
|
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
|
# 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).
|
# 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
|
This manages the cmdset for the "closed" button state. What this
|
||||||
means is that while this script is valid, we add the RedButtonClosed
|
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)
|
self.obj.cmdset.delete(cmdsetexamples.LidClosedCmdSet)
|
||||||
|
|
||||||
|
|
||||||
class OpenLidState(Script):
|
class OpenLidState(DefaultScript):
|
||||||
"""
|
"""
|
||||||
This manages the cmdset for the "open" button state. This will add
|
This manages the cmdset for the "open" button state. This will add
|
||||||
the RedButtonOpen
|
the RedButtonOpen
|
||||||
|
|
@ -97,7 +97,7 @@ class OpenLidState(Script):
|
||||||
self.obj.cmdset.delete(cmdsetexamples.LidOpenCmdSet)
|
self.obj.cmdset.delete(cmdsetexamples.LidOpenCmdSet)
|
||||||
|
|
||||||
|
|
||||||
class BlindedState(Script):
|
class BlindedState(DefaultScript):
|
||||||
"""
|
"""
|
||||||
This is a timed state.
|
This is a timed state.
|
||||||
|
|
||||||
|
|
@ -152,7 +152,7 @@ class BlindedState(Script):
|
||||||
# that makes the lid covering the button slide back after a while.
|
# 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
|
This event closes the glass lid over the button
|
||||||
some time after it was opened. It's a one-off
|
some time after it was opened. It's a one-off
|
||||||
|
|
@ -195,7 +195,7 @@ class CloseLidEvent(Script):
|
||||||
"""
|
"""
|
||||||
self.obj.close_lid()
|
self.obj.close_lid()
|
||||||
|
|
||||||
class BlinkButtonEvent(Script):
|
class BlinkButtonEvent(DefaultScript):
|
||||||
"""
|
"""
|
||||||
This timed script lets the button flash at regular intervals.
|
This timed script lets the button flash at regular intervals.
|
||||||
"""
|
"""
|
||||||
|
|
@ -225,7 +225,7 @@ class BlinkButtonEvent(Script):
|
||||||
"""
|
"""
|
||||||
self.obj.blink()
|
self.obj.blink()
|
||||||
|
|
||||||
class DeactivateButtonEvent(Script):
|
class DeactivateButtonEvent(DefaultScript):
|
||||||
"""
|
"""
|
||||||
This deactivates the button for a short while (it won't blink, won't
|
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
|
close its lid etc). It is meant to be called when the button is pushed
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ This defines some generally useful scripts for the tutorial world.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import random
|
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
|
This script, which should be tied to a particular object upon
|
||||||
instantiation, calls update_irregular on the object at random
|
instantiation, calls update_irregular on the object at random
|
||||||
|
|
@ -88,7 +88,7 @@ class FastIrregularEvent(IrregularEvent):
|
||||||
# RESET_SUBSCRIBERS = ["examples.tutorial_world.p_weapon_rack",
|
# RESET_SUBSCRIBERS = ["examples.tutorial_world.p_weapon_rack",
|
||||||
# "examples.tutorial_world.p_mob"]
|
# "examples.tutorial_world.p_mob"]
|
||||||
|
|
||||||
# class EventResetTutorialWorld(Script):
|
# class EventResetTutorialWorld(DefaultScript):
|
||||||
# """
|
# """
|
||||||
# This calls the reset function on all subscribed objects
|
# This calls the reset function on all subscribed objects
|
||||||
# """
|
# """
|
||||||
|
|
|
||||||
|
|
@ -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
|
A script type is customized by redefining some or all of its hook
|
||||||
methods and variables.
|
methods and variables.
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ Player that are controlled by the server.
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from evennia.players.players import DefaultPlayer
|
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.command import Command
|
||||||
from evennia.commands.cmdset import CmdSet
|
from evennia.commands.cmdset import CmdSet
|
||||||
from evennia.utils import search
|
from evennia.utils import search
|
||||||
|
|
@ -18,7 +18,7 @@ _SESSIONS = None
|
||||||
|
|
||||||
# Bot helper utilities
|
# Bot helper utilities
|
||||||
|
|
||||||
class BotStarter(Script):
|
class BotStarter(DefaultScript):
|
||||||
"""
|
"""
|
||||||
This non-repeating script has the
|
This non-repeating script has the
|
||||||
sole purpose of kicking its bot
|
sole purpose of kicking its bot
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ from evennia.scripts.manager import ScriptManager
|
||||||
from evennia.comms import channelhandler
|
from evennia.comms import channelhandler
|
||||||
from evennia.utils import logger
|
from evennia.utils import logger
|
||||||
|
|
||||||
__all__ = ["Script", "DoNothing", "CheckSessions",
|
__all__ = ["DefaultScript", "DoNothing", "CheckSessions",
|
||||||
"ValidateScripts", "ValidateChannelHandler"]
|
"ValidateScripts", "ValidateChannelHandler"]
|
||||||
|
|
||||||
_GA = object.__getattribute__
|
_GA = object.__getattribute__
|
||||||
|
|
@ -107,7 +107,7 @@ class ExtendedLoopingCall(LoopingCall):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
#
|
#
|
||||||
# Base script, inherit from Script below instead.
|
# Base script, inherit from DefaultScript below instead.
|
||||||
#
|
#
|
||||||
class ScriptBase(ScriptDB):
|
class ScriptBase(ScriptDB):
|
||||||
"""
|
"""
|
||||||
|
|
@ -346,7 +346,7 @@ class ScriptBase(ScriptDB):
|
||||||
# Base Script - inherit from this
|
# Base Script - inherit from this
|
||||||
#
|
#
|
||||||
|
|
||||||
class Script(ScriptBase):
|
class DefaultScript(ScriptBase):
|
||||||
"""
|
"""
|
||||||
This is the base TypeClass for all Scripts. Scripts describe events,
|
This is the base TypeClass for all Scripts. Scripts describe events,
|
||||||
timers and states in game, they can have a time component or describe
|
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.
|
# Some useful default Script types used by Evennia.
|
||||||
|
|
||||||
class DoNothing(Script):
|
class DoNothing(DefaultScript):
|
||||||
"An script that does nothing. Used as default fallback."
|
"An script that does nothing. Used as default fallback."
|
||||||
def at_script_creation(self):
|
def at_script_creation(self):
|
||||||
"Setup the script"
|
"Setup the script"
|
||||||
|
|
@ -534,7 +534,7 @@ class DoNothing(Script):
|
||||||
self.desc = _("This is an empty placeholder script.")
|
self.desc = _("This is an empty placeholder script.")
|
||||||
|
|
||||||
|
|
||||||
class Store(Script):
|
class Store(DefaultScript):
|
||||||
"Simple storage script"
|
"Simple storage script"
|
||||||
def at_script_creation(self):
|
def at_script_creation(self):
|
||||||
"Setup the script"
|
"Setup the script"
|
||||||
|
|
@ -542,7 +542,7 @@ class Store(Script):
|
||||||
self.desc = _("This is a generic storage container.")
|
self.desc = _("This is a generic storage container.")
|
||||||
|
|
||||||
|
|
||||||
class CheckSessions(Script):
|
class CheckSessions(DefaultScript):
|
||||||
"Check sessions regularly."
|
"Check sessions regularly."
|
||||||
def at_script_creation(self):
|
def at_script_creation(self):
|
||||||
"Setup the script"
|
"Setup the script"
|
||||||
|
|
@ -562,7 +562,7 @@ class CheckSessions(Script):
|
||||||
|
|
||||||
_FLUSH_CACHE = None
|
_FLUSH_CACHE = None
|
||||||
_IDMAPPER_CACHE_MAX_MEMORY = settings.IDMAPPER_CACHE_MAXSIZE
|
_IDMAPPER_CACHE_MAX_MEMORY = settings.IDMAPPER_CACHE_MAXSIZE
|
||||||
class ValidateIdmapperCache(Script):
|
class ValidateIdmapperCache(DefaultScript):
|
||||||
"""
|
"""
|
||||||
Check memory use of idmapper cache
|
Check memory use of idmapper cache
|
||||||
"""
|
"""
|
||||||
|
|
@ -579,7 +579,7 @@ class ValidateIdmapperCache(Script):
|
||||||
from evennia.utils.idmapper.base import conditional_flush as _FLUSH_CACHE
|
from evennia.utils.idmapper.base import conditional_flush as _FLUSH_CACHE
|
||||||
_FLUSH_CACHE(_IDMAPPER_CACHE_MAX_MEMORY)
|
_FLUSH_CACHE(_IDMAPPER_CACHE_MAX_MEMORY)
|
||||||
|
|
||||||
class ValidateScripts(Script):
|
class ValidateScripts(DefaultScript):
|
||||||
"Check script validation regularly"
|
"Check script validation regularly"
|
||||||
def at_script_creation(self):
|
def at_script_creation(self):
|
||||||
"Setup the script"
|
"Setup the script"
|
||||||
|
|
@ -594,7 +594,7 @@ class ValidateScripts(Script):
|
||||||
ScriptDB.objects.validate()
|
ScriptDB.objects.validate()
|
||||||
|
|
||||||
|
|
||||||
class ValidateChannelHandler(Script):
|
class ValidateChannelHandler(DefaultScript):
|
||||||
"Update the channelhandler to make sure it's in sync."
|
"Update the channelhandler to make sure it's in sync."
|
||||||
def at_script_creation(self):
|
def at_script_creation(self):
|
||||||
"Setup the script"
|
"Setup the script"
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ total runtime of the server and the current uptime.
|
||||||
|
|
||||||
from time import time
|
from time import time
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from evennia.scripts.scripts import Script
|
from evennia.scripts.scripts import DefaultScript
|
||||||
from evennia.utils.create import create_script
|
from evennia.utils.create import create_script
|
||||||
|
|
||||||
GAMETIME_SCRIPT_NAME = "sys_game_time"
|
GAMETIME_SCRIPT_NAME = "sys_game_time"
|
||||||
|
|
@ -40,7 +40,7 @@ SERVER_STARTTIME = time()
|
||||||
SERVER_RUNTIME = 0.0
|
SERVER_RUNTIME = 0.0
|
||||||
|
|
||||||
|
|
||||||
class GameTime(Script):
|
class GameTime(DefaultScript):
|
||||||
"""
|
"""
|
||||||
This script repeatedly saves server times so
|
This script repeatedly saves server times so
|
||||||
it can be retrieved after server downtime.
|
it can be retrieved after server downtime.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue