mirror of
https://github.com/evennia/evennia.git
synced 2026-04-18 14:19:05 +02:00
Updated game/ for the ev API. There will likely be some changes happening in the game/folder, in the way new objects are inherited. This should use the API rather than inherit from the basecommand/baseobject modules (these will probably into the example folders as vanilla templates instead).
This commit is contained in:
parent
3466e406f6
commit
88c0087fbd
13 changed files with 66 additions and 43 deletions
|
|
@ -18,15 +18,14 @@ new cmdset class.
|
|||
|
||||
"""
|
||||
|
||||
from src.commands.cmdset import CmdSet
|
||||
from src.commands.default import cmdset_default, cmdset_unloggedin, cmdset_ooc
|
||||
from game.gamesrc.commands.basecommand import Command
|
||||
from ev import CmdSet, Command
|
||||
from ev import default_cmds
|
||||
|
||||
#from contrib import menusystem, lineeditor
|
||||
#from contrib import misc_commands
|
||||
#from contrib import chargen
|
||||
|
||||
class DefaultCmdSet(cmdset_default.DefaultCmdSet):
|
||||
class DefaultCmdSet(default_cmds.DefaultCmdSet):
|
||||
"""
|
||||
This is an example of how to overload the default command
|
||||
set defined in src/commands/default/cmdset_default.py.
|
||||
|
|
@ -52,7 +51,7 @@ class DefaultCmdSet(cmdset_default.DefaultCmdSet):
|
|||
#self.add(lineeditor.CmdEditor())
|
||||
#self.add(misc_commands.CmdQuell())
|
||||
|
||||
class UnloggedinCmdSet(cmdset_unloggedin.UnloggedinCmdSet):
|
||||
class UnloggedinCmdSet(default_cmds.UnloggedinCmdSet):
|
||||
"""
|
||||
This is an example of how to overload the command set of the
|
||||
unlogged in commands, defined in
|
||||
|
|
@ -76,7 +75,7 @@ class UnloggedinCmdSet(cmdset_unloggedin.UnloggedinCmdSet):
|
|||
# any commands you add below will overload the default ones.
|
||||
#
|
||||
|
||||
class OOCCmdSet(cmdset_ooc.OOCCmdSet):
|
||||
class OOCCmdSet(default_cmds.OOCCmdSet):
|
||||
"""
|
||||
This is set is available to the player when they have no
|
||||
character connected to them (i.e. they are out-of-character, ooc).
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ See src/commands/default/muxcommand.py for an example.
|
|||
|
||||
"""
|
||||
|
||||
from src.commands.command import Command as BaseCommand
|
||||
from src.commands.default.muxcommand import MuxCommand as BaseMuxCommand
|
||||
from src.utils import utils
|
||||
from ev import Command as BaseCommand
|
||||
from ev import default_cmd
|
||||
from ev import utils
|
||||
|
||||
class MuxCommand(BaseMuxCommand):
|
||||
class MuxCommand(default_cmd.MuxCommand):
|
||||
"""
|
||||
This sets up the basis for a Evennia's 'MUX-like' command
|
||||
style. The idea is that most other Mux-related commands should
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ cmdset - this way you can often re-use the commands too.
|
|||
"""
|
||||
|
||||
import random
|
||||
from src.commands.cmdset import CmdSet
|
||||
from game.gamesrc.commands.basecommand import Command
|
||||
from ev import CmdSet
|
||||
from ev import Command
|
||||
|
||||
# Some simple commands for the red button
|
||||
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ New instances of Objects (inheriting from these typeclasses)
|
|||
are created with src.utils.create.create_object(typeclass, ...)
|
||||
where typeclass is the python path to the class you want to use.
|
||||
"""
|
||||
from src.objects.objects import Object as BaseObject
|
||||
from src.objects.objects import Character as BaseCharacter
|
||||
from src.objects.objects import Room as BaseRoom
|
||||
from src.objects.objects import Exit as BaseExit
|
||||
from src.players.player import Player as BasePlayer
|
||||
from ev import Object as BaseObject
|
||||
from ev import Character as BaseCharacter
|
||||
from ev import Room as BaseRoom
|
||||
from ev import Exit as BaseExit
|
||||
from ev import Player as BasePlayer
|
||||
|
||||
class Object(BaseObject):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ Create this button with
|
|||
Note that if you must drop the button before you can see its messages!
|
||||
"""
|
||||
import random
|
||||
from game.gamesrc.objects.baseobjects import Object
|
||||
from ev import Object
|
||||
from game.gamesrc.scripts.examples import red_button_scripts as scriptexamples
|
||||
from game.gamesrc.commands.examples import cmdset_red_button as cmdsetexamples
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ src.utils.create.create_script(scriptclass, ...) where scriptclass
|
|||
is the python path to the specific class of script you want to use.
|
||||
"""
|
||||
|
||||
from src.scripts.scripts import Script as BaseScript
|
||||
from ev import Script as BaseScript
|
||||
|
||||
class Script(BaseScript):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ or you won't see any messages!
|
|||
|
||||
"""
|
||||
import random
|
||||
from game.gamesrc.scripts.basescript import Script
|
||||
from ev import Script
|
||||
|
||||
class BodyFunctions(Script):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ red_button object type in gamesrc/types/examples. A few variations
|
|||
on uses of scripts are included.
|
||||
|
||||
"""
|
||||
from game.gamesrc.scripts.basescript import Script
|
||||
from ev import Script
|
||||
from game.gamesrc.commands.examples import cmdset_red_button as cmdsetexamples
|
||||
|
||||
#
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
# everything in this block will be appended to the beginning of
|
||||
# all other #CODE blocks when they are executed.
|
||||
|
||||
from src.utils import create, search
|
||||
from ev import create, search
|
||||
from game.gamesrc.objects.examples import red_button
|
||||
from game.gamesrc.objects import baseobjects
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|||
# Get Evennia version
|
||||
#------------------------------------------------------------
|
||||
try:
|
||||
VERSION = open("%s%s%s" % (os.pardir, os.sep, 'VERSION')).readline().strip()
|
||||
with open(os.pardir + os.sep + 'VERSION') as f:
|
||||
VERSION = "%s-r%s" % (f.read().strip(), os.popen("hg id -i").read().strip())
|
||||
except IOError:
|
||||
VERSION = "Unknown version"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue