Commit graph

78 commits

Author SHA1 Message Date
Griatch
e2f92f0bfe Resolved issue99, which concerned commands on adjacent players being erroneously included among a player's available commands (giving multiple-command errors). 2010-09-03 19:33:17 +00:00
Griatch
4d8fc05157 Cleaned up the batch processors (both cmd- and code processor) and homogenized their interfaces and APIs. Also test-ran the example codes and fixed some bugs. 2010-09-02 11:39:01 +00:00
Griatch
900f6da80f Fixed several special cases of handling multiple same-named commands gracefully. Should resolve issue94. 2010-09-01 21:59:13 +00:00
Griatch
f83c2bddf8 Trunk: Merged the Devel-branch (branches/griatch) into /trunk. This constitutes a major refactoring of Evennia. Development will now continue in trunk. See the wiki and the past posts to the mailing list for info. /Griatch 2010-08-29 18:46:58 +00:00
Griatch
df29defbcd Added gamesrc/utils.py as a convenient shorthand for often-used methods from the engine
Added a @deluser command and gave it and @boot an option to give a reason for booting/deleting a player
Fixed a bug in @dig that confused exit directions in text
Small bug fixes
/Griatch
2009-12-20 20:51:26 +00:00
Griatch
81bec61d7d Added the apropos command for broader help searching (uses icontains).
The suggestions: footer used in help gave too narrow results, now using apropos-style search instead.
Bug fix of state-help command to make it accept switches.
Added several new example commands and cleaned up old ones to be more user-friendly.
Added protection in @delevent to make it harder to delete system events.
Some small bug fixes and other cleanup.
2009-12-20 12:39:08 +00:00
Griatch
c7cbc4854e Reworked object command tables.
Object commands used to require re-adding every call in the script parent's __init__ or factory functions, adding the commands to a new command table directly on the object. Since all other attributes can be set up in at_object_creation(), this was both inconsistent and a bit confusing to work with. There is now a method add_commands() directly defined on all objects. It takes the same arguments as the normal add_command()o but use a reserved attribute to create and update a command table on the object. This has the advantange of completely removing the __init__ call in the script parent, all definitions can now be kept in at_object_creation() and are, more importantly, persistent without having to be recreated every call.
- I updated the examine command to show all the commands defined on an object (if any).
- I updated gamesrc/parents/examples/red_button.py considerably using the new command methodology and also using the updated Events.
.
Griatch
2009-12-03 00:41:53 +00:00
Griatch
4d9081d710 Various cleanups in the recent modifications, and improvements to how time is handled and displayed.
.
Griatch
2009-11-25 19:27:32 +00:00
Griatch
1ea7e69821 Implemented persistent cache, events and gametime counter.
OBS - there is a new data table (for the persistent cache) so you need to sync or restart with your database.

* Persistent cache (pcache)- this works the same as the volatile cache, except it is regularly saved to disk and recovered upon restart. How often the pcache is backed up is set in preferences. This was heck of a tricky thing to get right due to the intricacies of pickle; for example it turns out there is a bug in cPickle, so only normal pickle works to store the cache objects.
* Persistent events - this makes use of the pcache to re-load the scheduled events every reload. Only events with the property "persistent" will be saved this way (if not set, events will get lost upon reboot, just like now). All the main system events have been implemented as persistent events, including a new event to regularly save the pcache to disk.
* In order to track persistent event timers across reboots, there is also a global "game time" defined now. This is saved in cache and counts seconds only when the server is running. Event timers are adjusted with an offset when restarting (otherwise they will be confused by the real time jumping forward after a downtime). There are also a small set of helpful routines in src/gametime.py to help convert from real time to game time (for easy creation of new events).
* Various info commands have been updated to incoorporate the time stamp and the cache sync information.
* There are a few test commands commented out in commands/general.py that I used for testing; I left them in if you want to test things quickly. It works here, but as always more people testing is needed.
/Griatch
2009-11-22 21:18:55 +00:00
Griatch
642932a403 * Implemented a non-persistent cache in src/cache.py. The cache is lost when restarting the server but it has the advantage of not hitting the database, and so is useful for implementing things that should be remembered over time but does not need to be persistently saved in the database at every point, like fast-updating combat systems, timers etc. Using the cache can substantially cut down on database access at the cost of memory comsumption. It is easiest accessed through the object model using normal dot notation. So to store a variable in volatile memory e.g. from your script parent, you can do things like self.scripted_obj.cache.myvariable = variable and be sure that later (unless there was a reboot) doing self.scripted_obj.cache.myvariable will return the value you stored there.
* OBS - doing e.g. self.scripted_obj.myvariable = variable was always iffy and since a few revisions back this will NOT work - this is because the objects are now consistently synced with the database (in the past this was not done consistently which caused strange behaviour).
* Fixed some bugs in the multi-word command handler. It can handle multi-word exits as well now.
2009-11-01 15:12:38 +00:00
Griatch
eb6f82fea0 Added an at_obj_receive hook to basic player/object script parents. This allows
e.g. room parents to react when a player enters them.
2009-10-25 15:25:15 +00:00
Greg Taylor
239af1593d Fix issue #77, dealing with clearing objects out of a room being @dest'd. 2009-10-24 03:49:14 +00:00
Griatch
3be514ffdc Added high/low dbref limits to @find (Issue 59).
/Griatch
2009-10-22 20:59:19 +00:00
Griatch
656ecd9f97 Added VisibleKey, allowing objects to be locked so they are not visible by normal look command.
Fixed bug in create_object that sometimes caused rooms to be created with a location !=None
Expanded @destroy to better handle names and not just dbrefs.
/Griatch
2009-10-22 19:44:16 +00:00
Griatch
557c4eb07b Fixed bug in destroy command; cleaned up @dig a bit. 2009-10-22 14:30:57 +00:00
Griatch
9b6bd7125f Made several admin commands handle multi-word global searching; defined a new search function on objects.model for global name searching.
/Griatch
2009-10-21 18:42:52 +00:00
Griatch
a6ae6e936a Patched the batch-processor's interactive mode so it will not abort if it processes an object/script parent that changes the player's state. Also added a variable BATCH_IMPORT_PATH to config so one can keep all batch scripts in one location and don't have to write the full path to get them. Default is the new directory game/gamesrc/world.
Added the permission genperms.admin_nostate so that builders can avoid entering a state when working on a room with a state-changing parent. Superusers have to set the flag ADMIN_NOSTATE on themselves to achieve the same effect (this is necessary since superusers always have all permissions, so they would otherwise never be able to enter states).
/Griatch
2009-10-20 22:21:01 +00:00
Griatch
c575d098a0 Expanded @emit with more functionality.
Implemented @pemit (Issue 19)
Implemented @remit, @fsay and @fpose.
/Griatch
2009-10-15 17:31:44 +00:00
Griatch
84aeabb272 Some cleanup. Fixed all examples to match the changes in the states and help systems, also
ran them through pylint to pretty them up.
/Griatch
2009-10-15 09:43:34 +00:00
Griatch
8074617285 Largely rewrote and refactored the help system.
The help entry database structure has changed! You have to resync or purge
your database or your will get problems!

New features:
* Help entry access now fully controlled by evennia permissions
* Categories for each help entry
* All entries are created dynamically, with a See also: footer calculated
  after the current state of the database.
* Indexes and topic list calculated on the fly (alphabetically/after category)
* Added auto-help help entries for all default commands.
* Only shows commands _actually implemented_ - MUX help db moved into 'MUX' category
  which is not shown by default.
* More powerful auto-help markup - supports categories and permissions (and inheritance).
* Global on/off switch for auto-help, when entering production
* Auto_help_override switch for selectively activating auto-help when developing
  new commands (like the old system).
* Refactored State help system; no more risk of overwriting global help entries.
* State help now defers to main help db when no match found; makes system more transparent.
* State help entries also support categories/permissions (state categories are not
  used much though).

Other updates:
* Added more commands to the batch processor
* Many bug-fixes.

/Griatch
2009-10-14 18:15:15 +00:00
Griatch
42254355a0 Cleaned up @link, @open and @dig, making these commands more useful and less buggy with strange input. Also made them work not only with #dbrefs but with any unique game object (possibly one should limit this to e.g. room's); if there's a multiple match a list of the relevant dbrefs are shown. You can also now inspect links/home settins using this command.
@open also supports script_parents when creating exits.
/Griatch
2009-10-05 23:06:57 +00:00
Griatch
66095a0b16 Implemented locks.
The main command to use is @lock, which accept three types of locks at the moment, and three types of keys:
 Locks: DefaultLock, UseLock, EnterLock
 Keys: ObjectIDs, Groups, Permissions
This offers the most useful functionality - stopping people from picking up things, blocking exits and stopping
anyone from using an object.
If the attributes lock_msg, use_lock_msg and enter_lock_msg are defined on the locked object, these will be used
as error messages instead of a standard one (so "the door is locked" instead of "you cannot traverse that exit").

Behind the scenes, there is a new module, src/locks.py that defines Keys and Locks. A Locks object is a collection
of Lock types. This is stored in the LOCKS attribute on objects. Each Lock contains a set of Keys that might be
of mixed type and which the player must match in order to pass the lock.
/Griatch
2009-10-05 20:04:15 +00:00
Griatch
7f7306a6e4 - Implemented permission system management inside the game
- changed @chperm to @setperm to avoid confusion with channel commands
- added @setgroup command for adding user group permissions
- Moved permissions/group setup into settings file to allow admins to tweak without going into evennia engine.
- Add all new players to default permission group (defined in settings)
- Defined a basic group hierarchy, removed permission 'genperms.builder' in favour of a group named builders instead, containing all relevant permissions.
- Filtered out all django's automatic permissions in @setperm/list to make permission system more controlled by admin.
- Probably fixed bug that caused new users to not be signed up to channels (more testing needed)
- Added Exception handler in unloggedin method create, this was killing tracebacks upon user creation.
/Griatch
2009-10-03 14:40:34 +00:00
Griatch
82fe65f31f * Fixed bug in @reload that had modules reload in random order (causing custom user modules to not overwrite default ones properly).
* Added more info to multiple match search results, to show which matches are in inventory or not.
/Griatch
2009-09-28 20:45:36 +00:00
Griatch
35676b7660 Fixed bug in drop command, giving error log messages since it was trying to force non-player objects to execute a look when dropped. 2009-09-27 21:11:34 +00:00
Griatch
45ba9ea73c Fixed bug that had recycled objects not properly forget flags set on them before they were destroyed.
/Griatch
2009-09-27 16:36:03 +00:00
Griatch
0e46a61c85 * Added copy_object() to the object manager
* Added @copy command (builders only)
* Moved the greeting for first-time logins into a hook in basicplayer
* Fixed bug in @set to handle whitespace better
* Added the /drop switch to @create
/Griatch
2009-09-27 10:05:47 +00:00
Griatch
ee1b891ef4 * Refactored the structure of the code a bit, for easier plugin expansion. The create_object() function now handles all the basic aspects of setting up an object, instead of relying on @create/@dig to set up things like parents, default descs etc. This also calls the creation hook on_object_creation() now. As part of this, the set-script-parent mechanism changed a bit under the hood - the engine itself is calling the set_script_parent() method on Object now instead of setting it up on its own and/or trusting @create and @dig to do it. Also set up the default descs for different object classes into the defaults_global file for easier administration.
The @dig command now accepts the specification of parents for all entries (room and all exits). In principle it also supports ALIASes for each exit, but the ALIAS attribute does not seem to be operational at the moment.
/Griatch
2009-09-26 23:37:52 +00:00
Griatch
a5a0d92985 Added some more information to the move-announcement hooks; these also know from where the object is coming from (this can be useful for admins wanting to produce e.g. 'player arrives from <foo>' messages insteda of the default uninformative 'player arrives.'. )
/Griatch
2009-09-20 00:02:57 +00:00
Griatch
4cee971169 Fixed some bugs in move reporting. Made feedback from default commands a bit more informative and consistent. Added some more text and error handling to the login commands. 2009-09-19 20:48:06 +00:00
Griatch
8fbeea99dc Moved the last hard-wired emits from objects/models.py into scriptparent hooks. This allows the admin to customize this without having to mess with the engine.
Other small bugfixes, fixes to @dig to properly call creation hooks of all newly created objects (it was not setting anything before). Also fixed some of the annoying bugs around using several of the building commands that didn't properly handle spaces around the separator = symbol.
/Griatch
2009-09-19 15:18:42 +00:00
Griatch
b95d45e251 Added option to local_and_global_search() for matching against the value
of any desired attribute. Default is searching by name, as before. This
makes it easy for admins to search for objects and also for using other
attributes than names as primary identifiers (short descriptions comes to
mind).
/Griatch
2009-09-05 21:59:12 +00:00
Griatch
41365074fd Further fuzzy matching improvement, with integer list selection of multiple matches.
This uses exact-match-first fuzzy matching as discussed in previous commits. It also
use the match order to present a list of options to narrow the selection down - the user can
then specify the choice by appending the correct number to the query.
Example: objects: [box,box]; searching for "box" gives a multiple match error, which presents
a list looking like "1-box, 2-box". The user can now just write "2-box" to choose the second
box. Showing dbrefs is perhaps even more universal, but revealing the underlying data structure
to the normal user is not really good practice - dbrefs is only something builders and admins
should have to know about ... (IMHO).
/Griatch
2009-09-02 22:04:14 +00:00
Griatch
2aae4a0105 Cleaner implementation of the fuzzy matching fix I did; this also handels "true" multiple matches (such that there really are
>1 thing named "box" in the room); the previous implementation just picked the first occurence instead of giving a
multiple match error.
/Griatch
2009-09-02 17:57:54 +00:00
Griatch
68217072a6 Fixed an issue with "Fuzzy" pattern matching that would not find names at certain times.
For example, before the fix, you could face the following issue: Create a bunch of boxes with @create:
box, box1, box2, box3 ... Now try to examine 'box'. This would not work - the game would tell you that there
were multiple matches - it just found "box" in all entries and went with that. So despite there only being one
thing named solely "box", you could not target it! This fix resolves this by giving precedence to exact matches
whenever they exist. I have only done it for the support routine behind local_and_global_search() though, there
are other search functions that uses django directly for fuzzy __in searches. I don't know how to add a similar
functionality to them.
/Griatch
2009-08-30 20:18:56 +00:00
Griatch
1d4f075ca7 * Updated and expanded the State system; the API changed a bit. You now have to first *create* the state using
GLOBAL_STATE_TABLE.add_state() before adding commands to it. The state can now be much more configured by including as much or as
little of the normal default commands into it as wanted (so you can now have states which are almost as normal, except some
commands are missing or change their behaviour ... illness or darkness comes to mind). The possibilities here are limitless.
* States now also optionally allow traversing exits as well as using command tables defined on objects.
* States now better handle error messages (so if you try 'look' in a state which does not contain a look command you will no
longer get the 'Huh?' but will be told that the command is not available at the moment).
* All examples in commands/examples/ have been updated to use the new State system. Also added a @test_state function for trying out
the functionality.
* Added hooks at_before_move() and at_after_move(), useful for character based move-restrictions and checks (e.g. movement speed)
* Minor tweaks to the event system; avoiding the counters to go negative should they hit an uncaught traceback.
* Small fixes of typos and minor extra safety checks.
/Griatch
2009-08-16 01:18:58 +00:00
Greg Taylor
ddfd479ba9 Fix a really obscure bug with adding default channels. Had a string substitution that didn't match up and wasn't throwing an exception (for some weird reason).
Also add CommChannelMembershipAdmin.
2009-06-04 04:03:16 +00:00
Griatch
c339c1f6f6 Changed the input format of the create_object() function as suggested in the code. A more normal function now, no more strange dictionary input. 2009-05-03 18:21:12 +00:00
Griatch
05554e290a Moved the object's 'description' into an attribute, as suggested in the code. This means that get_description() and set_description() should no longer be used; instead use set_attribute('desc',value) and get_attribute('desc') as you would any attribute. 'desc' is used by the default look command, but apart from that, desc has no special status anymore.
/Griatch
2009-05-03 16:55:42 +00:00
Griatch
e7d7284d5c Added pickle'able attributes. The attribute.get_attr(), object.set_attribute and object.get_attribute_value() have been updated to accept and return values of any type. If the value is a string, it will be stored normally, other types will be pickled. Possibly we could choose to save also single numbers as strings, but not sure it's any faster to convert from string than it is from cPickle ...
To use these, you need to either start over with a fresh database or change the changed fields manually.
2009-05-02 19:02:36 +00:00
Griatch
cafbdf720e Minor typo-fixes as well as making some variable names more intuitive. 2009-05-01 15:56:19 +00:00
Griatch
0efe2c3095 Created a state system. See
http://groups.google.com/group/evennia/browse_thread/thread/66a7ff6cce5303b7
for more detailed description.

Created a new folder gamesrc/commands/examples and moved all examples in there.
/Griatch
2009-05-01 15:34:43 +00:00
Griatch
cae925c29b Made so the local_and_global_search strips the query of surrounding whitespace. Many calling functions don't do this properly, making it a source of bugs. E.g. "@desc obj = text" did not locate obj but "@desc obj= text" did. 2009-05-01 07:16:44 +00:00
Griatch
3eb4cddf42 - implemented @destroy as per the MUX help specifications. As part of this, fixed the object recycling routines to actually properly replace GARBAGE-flagged objects (it crashed before).
- Set up a global cleaner event to clean all @destroyed objects every 30 minutes (makes their dbrefs available).
- Added the @recover command for recovering @destroyed objects up until the point that the cleaner runs and actually destroys them. This can recover @destroyed objects, rooms and exits to the same state as before @destroy. It could easily be made to recover player objects too, but I'm thinking this would be a security issue.
- Added to @dig in order to allow for creating rooms with a particular parent. Also auto-creates exits in each room if desired. The only things that is not implemented is the aliases of the exits, I don't really know how to do that.
- Changed the @create command format to match the @dig (it uses : to mark the parent instead of = now, since MUX' @dig reserve = to the exit list.)
- Added extra security in the example event to guard against the bug that causes the whole scheduler to freak out if the event_function() gives a traceback.
- Changed many instances of type to point to the defines_global.OTYPE instead of giving the integer explicitly.
/Starkiel
2009-04-30 15:01:59 +00:00
Griatch
8799a0fd55 Added example of how to handle event errors gracefully without them taking down the server with with unhandled exceptions (this should be handled somewhere above exception too, but it's hard to tell when to do it since twisted is raising them). /Starkiel 2009-04-30 08:23:54 +00:00
Greg Taylor
70602efaa7 Remove an unneeded import that was causing a deprecation warning. 2009-04-30 02:52:16 +00:00
Griatch
a9dbac8aae - Made many small bugfixes to the @parent and @create functions as well as their underlying methods.
- Made it so user #1 is also affected by the on_player_creation() function.
- Added an event folder for custom events, including a working example
- Expanded the example commands and parents to include the changes to how they should be initialized.
- Added an optional ansi scheme (not active by default)
2009-04-25 20:51:12 +00:00
Griatch
a32840002c This change to set_script_parent() is also needed to get the previous @parent fixes to work, sorry for the omission. 2009-04-25 18:05:46 +00:00
Greg Taylor
9f86a4c586 I've been meaning to do this for a while as well. Break CommChannel and CommChannelMessage out into a separate app. I had them lumped in with objects/models.py due to some funkage with the admin site registering that is now resolved.
NOTE: You will need to syncdb and re-create any channels you may have had. Sorry for the inconvenience, we're still early enough in development where breakages like this may happen once in a blue moon.
2009-04-17 04:15:54 +00:00
Greg Taylor
573d1b6e88 Finally got around to creating admin.py files for all of the apps. This will prevent some really weird import errors and fixes an issue with the Attribute model's admin display. May also cut resource usage slightly for MUD server instances. Needs more testing! 2009-04-17 03:08:18 +00:00