home
·
contact
·
privacy
projects
/
plomrogue
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dedd7e9
)
Server: Transform PLUGIN command to God command, save its input.
author
Christian Heller
<c.heller@plomlompom.de>
Sat, 20 Feb 2016 10:22:24 +0000
(11:22 +0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Sat, 20 Feb 2016 10:22:24 +0000
(11:22 +0100)
SERVER_COMMANDS
patch
|
blob
|
history
server/commands.py
patch
|
blob
|
history
server/config/commands.py
patch
|
blob
|
history
server/config/world_data.py
patch
|
blob
|
history
server/io.py
patch
|
blob
|
history
diff --git
a/SERVER_COMMANDS
b/SERVER_COMMANDS
index e959f258c37ab04cac61e66dbd26058102b24640..41759aacc408f4643024d3c7bf61c81ee0d1993a 100644
(file)
--- a/
SERVER_COMMANDS
+++ b/
SERVER_COMMANDS
@@
-52,10
+52,6
@@
game world is set active.
Meta commands
-------------
Meta commands
-------------
-PLUGIN [string]
-Run plugin code in ./plugins/[argument], with argument only consisting of
-alphanumeric characters and underscores.
-
PING
Write "PONG" line to ./server_run/out file.
PING
Write "PONG" line to ./server_run/out file.
@@
-95,6
+91,10
@@
inventory.
God commands
------------
God commands
------------
+PLUGIN [string]
+Run plugin code in ./plugins/[argument], with argument only consisting of
+alphanumeric characters and underscores.
+
TURN [0 to 65535]
Set world turn to argument. (Initial value: 0.)
TURN [0 to 65535]
Set world turn to argument. (Initial value: 0.)
diff --git
a/server/commands.py
b/server/commands.py
index a3b68bcc62dfc810e22035e06d3b3a5eb0fe8771..a1f97c98a8d10e9a6076afbe34fb1b2beace3c1e 100644
(file)
--- a/
server/commands.py
+++ b/
server/commands.py
@@
-17,6
+17,7
@@
def command_plugin(str_plugin):
if (str_plugin.replace("_", "").isalnum()
and os.access("plugins/server/" + str_plugin, os.F_OK)):
exec(open("plugins/server/" + str_plugin).read())
if (str_plugin.replace("_", "").isalnum()
and os.access("plugins/server/" + str_plugin, os.F_OK)):
exec(open("plugins/server/" + str_plugin).read())
+ world_db["PLUGIN"] += [str_plugin]
return
print("Bad plugin name:", str_plugin)
return
print("Bad plugin name:", str_plugin)
diff --git
a/server/config/commands.py
b/server/config/commands.py
index 84ac8e298c32d79c381bd1278a4ba3f9e20f252a..96c31cc40d5dc2f4ba56d1e684567610f344492d 100644
(file)
--- a/
server/config/commands.py
+++ b/
server/config/commands.py
@@
-20,7
+20,7
@@
be ignored in replay mode if read from server input file), and ([2]) a function
to be called on it.
"""
commands_db = {
to be called on it.
"""
commands_db = {
- "PLUGIN": (1,
Tru
e, command_plugin),
+ "PLUGIN": (1,
Fals
e, command_plugin),
"QUIT": (0, True, command_quit),
"PING": (0, True, command_ping),
"THINGS_HERE": (2, True, command_thingshere),
"QUIT": (0, True, command_quit),
"PING": (0, True, command_ping),
"THINGS_HERE": (2, True, command_thingshere),
diff --git
a/server/config/world_data.py
b/server/config/world_data.py
index e9c6bac21551e7b78b36c295c48e9a76d480c3db..e8639c5b551494f4e4a92952e650bb9b5ac31664 100644
(file)
--- a/
server/config/world_data.py
+++ b/
server/config/world_data.py
@@
-10,6
+10,7
@@
world_db = {
"PLAYER_TYPE": 0,
"WORLD_ACTIVE": 0,
"MAP": False,
"PLAYER_TYPE": 0,
"WORLD_ACTIVE": 0,
"MAP": False,
+ "PLUGIN": [],
"ThingActions": {},
"ThingTypes": {},
"Things": {}
"ThingActions": {},
"ThingTypes": {},
"Things": {}
diff --git
a/server/io.py
b/server/io.py
index 0357b2e6c5946770cbcdda7f3df14e485573d044..ab3bbffc071e7e7b739c82f921ee4df71f22676b 100644
(file)
--- a/
server/io.py
+++ b/
server/io.py
@@
-180,9
+180,12
@@
def save_world():
string = ""
for key in sorted(world_db.keys()):
string = ""
for key in sorted(world_db.keys()):
- if (not isinstance(world_db[key], dict)) and key != "MAP" and \
+ if (not isinstance(world_db[key], dict) and
+ not isinstance(world_db[key], list)) and key != "MAP" and \
key != "WORLD_ACTIVE":
string = string + key + " " + str(world_db[key]) + "\n"
key != "WORLD_ACTIVE":
string = string + key + " " + str(world_db[key]) + "\n"
+ for plugin in world_db["PLUGIN"]:
+ string = string + "PLUGIN " + plugin + "\n"
string = string + mapsetter("MAP")()
string = string + helper("ThingActions", "TA_ID")
string = string + helper("ThingTypes", "TT_ID", {"TT_CORPSE_ID": False})
string = string + mapsetter("MAP")()
string = string + helper("ThingActions", "TA_ID")
string = string + helper("ThingTypes", "TT_ID", {"TT_CORPSE_ID": False})