Skip to content

Commit

Permalink
finally imported channel.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiogaplanet committed May 4, 2022
1 parent 7f17129 commit bd68ae8
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 68 deletions.
4 changes: 2 additions & 2 deletions server/conf/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

# Typeclass for account objects (linked to a character) (fallback)
BASE_ACCOUNT_TYPECLASS = "typeclasses.base.Account"
# Typeclass for Channel (fallback).
BASE_CHANNEL_TYPECLASS = "typeclasses.base.Channel"
# Typeclass for Exit objects (fallback).
BASE_EXIT_TYPECLASS = "typeclasses.base.Exit"
# Typeclass for character objects linked to an account (fallback)
Expand All @@ -47,8 +49,6 @@
# Typeclass for Scripts (fallback). You usually don't need to change this
# but create custom variations of scripts on a per-case basis instead.
BASE_SCRIPT_TYPECLASS = "typeclasses.base.Script"
# Typeclass for Channel (fallback).
#BASE_CHANNEL_TYPECLASS = "typeclasses.base.Channel"

######################################################################
# Settings given in secret_settings.py override those in this file.
Expand Down
74 changes: 70 additions & 4 deletions typeclasses/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ def reset(self):

from evennia import CmdSet, Command, DefaultRoom
from evennia import utils, create_object, search_object
from evennia import syscmdkeys, default_cmds
from evennia import syscmdkeys
from evennia.commands.default.muxcommand import MuxCommand
from evennia.commands.default.general import CmdLook


# the system error-handling module is defined in the settings. We load the
Expand All @@ -248,7 +250,7 @@ def reset(self):
# for the @detail command we inherit from MuxCommand, since
# we want to make use of MuxCommand's pre-parsing of '=' in the
# argument.
class CmdSetDetail(default_cmds.MuxCommand):
class CmdSetDetail(MuxCommand):
"""
sets a detail on a room
Expand Down Expand Up @@ -291,7 +293,7 @@ def func(self):
self.caller.msg("Detail set: '%s': '%s'" % (self.lhs, self.rhs))


class CmdLook(default_cmds.CmdLook):
class CmdLook(CmdLook):
"""
looks at the room and on details
Expand Down Expand Up @@ -370,7 +372,7 @@ def func(self):
return


class CmdGiveUp(default_cmds.MuxCommand):
class CmdGiveUp(MuxCommand):
"""
Give up the quest and return to Limbo, the start room of the server.
"""
Expand Down Expand Up @@ -568,3 +570,67 @@ class is first created.
"""

pass


"""
Channel
The channel class represents the out-of-character chat-room usable by
Accounts in-game. It is mostly overloaded to change its appearance, but
channels can be used to implement many different forms of message
distribution systems.
Note that sending data to channels are handled via the CMD_CHANNEL
syscommand (see evennia.syscmds). The sending should normally not need
to be modified.
"""

from evennia import DefaultChannel


class Channel(DefaultChannel):
"""
Working methods:
at_channel_creation() - called once, when the channel is created
has_connection(account) - check if the given account listens to this channel
connect(account) - connect account to this channel
disconnect(account) - disconnect account from channel
access(access_obj, access_type='listen', default=False) - check the
access on this channel (default access_type is listen)
delete() - delete this channel
message_transform(msg, emit=False, prefix=True,
sender_strings=None, external=False) - called by
the comm system and triggers the hooks below
msg(msgobj, header=None, senders=None, sender_strings=None,
persistent=None, online=False, emit=False, external=False) - main
send method, builds and sends a new message to channel.
tempmsg(msg, header=None, senders=None) - wrapper for sending non-persistent
messages.
distribute_message(msg, online=False) - send a message to all
connected accounts on channel, optionally sending only
to accounts that are currently online (optimized for very large sends)
Useful hooks:
channel_prefix(msg, emit=False) - how the channel should be
prefixed when returning to user. Returns a string
format_senders(senders) - should return how to display multiple
senders to a channel
pose_transform(msg, sender_string) - should detect if the
sender is posing, and if so, modify the string
format_external(msg, senders, emit=False) - format messages sent
from outside the game, like from IRC
format_message(msg, emit=False) - format the message body before
displaying it to the user. 'emit' generally means that the
message should not be displayed with the sender's name.
pre_join_channel(joiner) - if returning False, abort join
post_join_channel(joiner) - called right after successful join
pre_leave_channel(leaver) - if returning False, abort leave
post_leave_channel(leaver) - called right after successful leave
pre_send_message(msg) - runs just before a message is sent to channel
post_send_message(msg) - called just after message was sent to channel
"""

pass
62 changes: 0 additions & 62 deletions typeclasses/channels.py

This file was deleted.

0 comments on commit bd68ae8

Please sign in to comment.