From 07146606cb1b3fa9e4c65e42408b82990c2364b0 Mon Sep 17 00:00:00 2001 From: Samuel Walladge Date: Sat, 12 Mar 2016 11:10:13 +1030 Subject: [PATCH 01/12] restructure of config directory/files layout --- .gitignore | 7 +- .../config.txt.default => configs/config.json | 0 configs/config.json.default | 146 ++++++++++++++++++ .../maps/classicgen.txt | 0 {feature_server => configs}/maps/random.txt | 0 .../scripts/__init__.py | 0 {feature_server => configs}/scripts/afk.py | 0 .../scripts/airstrike.py | 0 .../scripts/antijerk.py | 0 .../scripts/autohelp.py | 0 .../scripts/blockinfo.py | 0 {feature_server => configs}/scripts/bugfix.py | 0 .../scripts/commandhelp.py | 0 .../scripts/daycycle.py | 0 .../scripts/demolitionman.py | 0 .../scripts/dirtnade.py | 0 {feature_server => configs}/scripts/disco.py | 0 .../scripts/fbpatch.py | 0 .../scripts/flagreturn.py | 0 .../scripts/grownade.py | 0 .../scripts/infiltration.py | 0 .../scripts/map_extensions.py | 0 .../scripts/markers.py | 0 {feature_server => configs}/scripts/match.py | 0 {feature_server => configs}/scripts/medkit.py | 0 .../scripts/memcheck.py | 0 .../scripts/minefield.py | 0 {feature_server => configs}/scripts/paint.py | 0 .../scripts/passreload.py | 0 .../scripts/platform.py | 0 .../scripts/protect.py | 0 {feature_server => configs}/scripts/query.py | 0 .../scripts/rampage.py | 0 .../scripts/rangedamage.py | 0 {feature_server => configs}/scripts/rapid.py | 0 {feature_server => configs}/scripts/ratio.py | 0 .../scripts/rollback.py | 0 .../scripts/runningman.py | 0 .../scripts/savemap.py | 0 .../scripts/spawn_protect.py | 0 {feature_server => configs}/scripts/squad.py | 0 {feature_server => configs}/scripts/stats.py | 0 .../scripts/strongblock.py | 0 {feature_server => configs}/scripts/tdm.py | 0 {feature_server => configs}/scripts/tow.py | 0 .../scripts/trusted.py | 0 .../scripts/votekick.py | 0 .../scripts/votemap.py | 0 .../scripts/welcome.py | 0 {feature_server => configs}/scripts/zoc.py | 0 feature_server/map.py | 19 ++- feature_server/run.py | 58 ++++--- 52 files changed, 185 insertions(+), 45 deletions(-) rename feature_server/config.txt.default => configs/config.json (100%) create mode 100644 configs/config.json.default rename {feature_server => configs}/maps/classicgen.txt (100%) rename {feature_server => configs}/maps/random.txt (100%) rename {feature_server => configs}/scripts/__init__.py (100%) rename {feature_server => configs}/scripts/afk.py (100%) rename {feature_server => configs}/scripts/airstrike.py (100%) rename {feature_server => configs}/scripts/antijerk.py (100%) rename {feature_server => configs}/scripts/autohelp.py (100%) rename {feature_server => configs}/scripts/blockinfo.py (100%) rename {feature_server => configs}/scripts/bugfix.py (100%) rename {feature_server => configs}/scripts/commandhelp.py (100%) rename {feature_server => configs}/scripts/daycycle.py (100%) rename {feature_server => configs}/scripts/demolitionman.py (100%) rename {feature_server => configs}/scripts/dirtnade.py (100%) rename {feature_server => configs}/scripts/disco.py (100%) rename {feature_server => configs}/scripts/fbpatch.py (100%) rename {feature_server => configs}/scripts/flagreturn.py (100%) rename {feature_server => configs}/scripts/grownade.py (100%) rename {feature_server => configs}/scripts/infiltration.py (100%) rename {feature_server => configs}/scripts/map_extensions.py (100%) rename {feature_server => configs}/scripts/markers.py (100%) rename {feature_server => configs}/scripts/match.py (100%) rename {feature_server => configs}/scripts/medkit.py (100%) rename {feature_server => configs}/scripts/memcheck.py (100%) rename {feature_server => configs}/scripts/minefield.py (100%) rename {feature_server => configs}/scripts/paint.py (100%) rename {feature_server => configs}/scripts/passreload.py (100%) rename {feature_server => configs}/scripts/platform.py (100%) rename {feature_server => configs}/scripts/protect.py (100%) rename {feature_server => configs}/scripts/query.py (100%) rename {feature_server => configs}/scripts/rampage.py (100%) rename {feature_server => configs}/scripts/rangedamage.py (100%) rename {feature_server => configs}/scripts/rapid.py (100%) rename {feature_server => configs}/scripts/ratio.py (100%) rename {feature_server => configs}/scripts/rollback.py (100%) rename {feature_server => configs}/scripts/runningman.py (100%) rename {feature_server => configs}/scripts/savemap.py (100%) rename {feature_server => configs}/scripts/spawn_protect.py (100%) rename {feature_server => configs}/scripts/squad.py (100%) rename {feature_server => configs}/scripts/stats.py (100%) rename {feature_server => configs}/scripts/strongblock.py (100%) rename {feature_server => configs}/scripts/tdm.py (100%) rename {feature_server => configs}/scripts/tow.py (100%) rename {feature_server => configs}/scripts/trusted.py (100%) rename {feature_server => configs}/scripts/votekick.py (100%) rename {feature_server => configs}/scripts/votemap.py (100%) rename {feature_server => configs}/scripts/welcome.py (100%) rename {feature_server => configs}/scripts/zoc.py (100%) diff --git a/.gitignore b/.gitignore index 78ab6fe4..73cf71da 100644 --- a/.gitignore +++ b/.gitignore @@ -24,10 +24,11 @@ enet/build/ venv/ # feature server -feature_server/logs/ feature_server/data/ -feature_server/config.txt -feature_server/maps/*.txtc + +# config/userdata +configs/maps/*.txtc +configs/logs/ # py2exe py2exe/dist/ diff --git a/feature_server/config.txt.default b/configs/config.json similarity index 100% rename from feature_server/config.txt.default rename to configs/config.json diff --git a/configs/config.json.default b/configs/config.json.default new file mode 100644 index 00000000..bc23d784 --- /dev/null +++ b/configs/config.json.default @@ -0,0 +1,146 @@ +{ + "name" : "PySnip server", + "motd" : [ + "Welcome to %(server_name)s", + "Map: %(map_name)s by %(map_author)s", + "Game mode: %(game_mode)s", + "Server powered by PySnip and BuildAndShoot.com" + ], + "help" : [ + "Server name: %(server_name)s", + "Map: %(map_name)s by %(map_author)s", + "Game mode: %(game_mode)s", + "/STREAK Shows how many kills in a row you got without dying", + "/INTEL Tells you who's got the enemy intel", + "/VOTEKICK Start a vote to temporarily ban a disruptive player", + "/TIME Remaining time until forced map reset" + ], + "tips" : [ + "You are playing %(game_mode)s on %(server_name)s", + "Type /help for info & commands" + ], + "tip_frequency" : 5, + "rules" : [ + "Cheating isn't welcome. Griefing is frowned upon. Have fun!" + ], + "master" : true, + "max_players" : 32, + "max_connections_per_ip" : 3, + "port" : 32887, + "network_interface" : "", + + "game_mode" : "ctf", + "cap_limit" : 10, + "default_time_limit" : 120, + "advance_on_win" : true, + "maps" : ["classicgen", "random"], + "random_rotation" : false, + + "respawn_time" : 16, + "respawn_waves" : true, + "friendly_fire" : "on_grief", + "grief_friendly_fire_time" : 5, + "spade_teamkills_on_grief" : false, + "balanced_teams" : 2, + "teamswitch_interval" : 0, + + "speedhack_detect" : false, + "votekick_percentage" : 35, + "votekick_ban_duration" : 30, + "votekick_public_votes" : true, + "votemap_public_votes" : true, + "votemap_extension_time" : 15, + "votemap_player_driven" : false, + "votemap_autoschedule" : false, + "votemap_time" : 120, + "votemap_percentage" : 80, + + "melee_damage" : 80, + "fall_damage" : true, + "user_blocks_only" : false, + "set_god_build" : false, + "server_prefix" : "", + "time_announcements" : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 30, 60, 120, 180, + 240, 300, 600, 900, 1200, 1800, 2400, 3000], + "login_retries" : 3, + "default_ban_duration" : 1440, + + "logfile" : "./logs/log.txt", + "rotate_daily" : true, + "debug_log" : false, + "profile" : false, + + "team1" : { + "name" : "Blue", + "color" : [0, 0, 255] + }, + "team2" : { + "name" : "Green", + "color" : [0, 255, 0] + }, + "passwords" : { + "admin" : ["adminpass1", "adminpass2", "adminpass3"], + "moderator" : ["modpass"], + "guard" : ["guardpass"], + "trusted" : ["trustedpass"] + }, + "rights" : { + "moderator" : ["advance", "cancel", "dban", "fog", "from", "goto", "hackinfo", "hban", "invisible", "ip", "kick", "kickafk", "kill", "map", "master", "move", "mute", "resetgame", "switch", "teleport", "teleport_other", "tpsilent", "togglebuild", "togglekill", "togglevotekick", "trust", "undoban", "unmute", "unstick", "where", "whowas"], + "guard" : ["cancel", "fog", "from", "goto", "hackinfo", "hban", "ip", "kick", "kickafk", "kill", "move", "mute", "switch", "teleport", "teleport_other", "togglebuild", "togglekill", "togglevotekick", "trust", "unmute", "unstick", "where", "whowas"] + }, + "ssh" : { + "enabled" : false, + "port" : 32887, + "users" : { + "user" : "ssh_pass_change_this" + } + }, + "status_server" : { + "enabled" : false, + "port" : 32886, + "logging" : false + }, + "ban_publish" : { + "enabled" : false, + "port" : 32885 + }, + "ban_subscribe" : { + "enabled" : true, + "urls" : [ + ["http://www.blacklist.spadille.net/subscribe.json", []] + ] + }, + "irc" : { + "enabled" : false, + "nickname" : "PySnip", + "username" : "PySnip", + "realname" : "PySnip", + "server" : "irc.quakenet.org", + "port" : 6667, + "channel" : "#MyServerChannel", + "password" : "", + "commandprefix" : "!", + "chatprefix" : "." + }, + "scripts" : [ + "rollback", + "protect", + "map_extensions", + "disco", + "votekick", + "trusted", + "ratio", + "passreload", + "blockinfo", + "bugfix", + "fbpatch", + "afk" + ], + + "squad_respawn_time" : 32, + "squad_size" : 4, + "auto_squad" : false, + "load_saved_map" : false, + "rollback_on_game_end" : false, + "afk_time_limit" : 30 +} \ No newline at end of file diff --git a/feature_server/maps/classicgen.txt b/configs/maps/classicgen.txt similarity index 100% rename from feature_server/maps/classicgen.txt rename to configs/maps/classicgen.txt diff --git a/feature_server/maps/random.txt b/configs/maps/random.txt similarity index 100% rename from feature_server/maps/random.txt rename to configs/maps/random.txt diff --git a/feature_server/scripts/__init__.py b/configs/scripts/__init__.py similarity index 100% rename from feature_server/scripts/__init__.py rename to configs/scripts/__init__.py diff --git a/feature_server/scripts/afk.py b/configs/scripts/afk.py similarity index 100% rename from feature_server/scripts/afk.py rename to configs/scripts/afk.py diff --git a/feature_server/scripts/airstrike.py b/configs/scripts/airstrike.py similarity index 100% rename from feature_server/scripts/airstrike.py rename to configs/scripts/airstrike.py diff --git a/feature_server/scripts/antijerk.py b/configs/scripts/antijerk.py similarity index 100% rename from feature_server/scripts/antijerk.py rename to configs/scripts/antijerk.py diff --git a/feature_server/scripts/autohelp.py b/configs/scripts/autohelp.py similarity index 100% rename from feature_server/scripts/autohelp.py rename to configs/scripts/autohelp.py diff --git a/feature_server/scripts/blockinfo.py b/configs/scripts/blockinfo.py similarity index 100% rename from feature_server/scripts/blockinfo.py rename to configs/scripts/blockinfo.py diff --git a/feature_server/scripts/bugfix.py b/configs/scripts/bugfix.py similarity index 100% rename from feature_server/scripts/bugfix.py rename to configs/scripts/bugfix.py diff --git a/feature_server/scripts/commandhelp.py b/configs/scripts/commandhelp.py similarity index 100% rename from feature_server/scripts/commandhelp.py rename to configs/scripts/commandhelp.py diff --git a/feature_server/scripts/daycycle.py b/configs/scripts/daycycle.py similarity index 100% rename from feature_server/scripts/daycycle.py rename to configs/scripts/daycycle.py diff --git a/feature_server/scripts/demolitionman.py b/configs/scripts/demolitionman.py similarity index 100% rename from feature_server/scripts/demolitionman.py rename to configs/scripts/demolitionman.py diff --git a/feature_server/scripts/dirtnade.py b/configs/scripts/dirtnade.py similarity index 100% rename from feature_server/scripts/dirtnade.py rename to configs/scripts/dirtnade.py diff --git a/feature_server/scripts/disco.py b/configs/scripts/disco.py similarity index 100% rename from feature_server/scripts/disco.py rename to configs/scripts/disco.py diff --git a/feature_server/scripts/fbpatch.py b/configs/scripts/fbpatch.py similarity index 100% rename from feature_server/scripts/fbpatch.py rename to configs/scripts/fbpatch.py diff --git a/feature_server/scripts/flagreturn.py b/configs/scripts/flagreturn.py similarity index 100% rename from feature_server/scripts/flagreturn.py rename to configs/scripts/flagreturn.py diff --git a/feature_server/scripts/grownade.py b/configs/scripts/grownade.py similarity index 100% rename from feature_server/scripts/grownade.py rename to configs/scripts/grownade.py diff --git a/feature_server/scripts/infiltration.py b/configs/scripts/infiltration.py similarity index 100% rename from feature_server/scripts/infiltration.py rename to configs/scripts/infiltration.py diff --git a/feature_server/scripts/map_extensions.py b/configs/scripts/map_extensions.py similarity index 100% rename from feature_server/scripts/map_extensions.py rename to configs/scripts/map_extensions.py diff --git a/feature_server/scripts/markers.py b/configs/scripts/markers.py similarity index 100% rename from feature_server/scripts/markers.py rename to configs/scripts/markers.py diff --git a/feature_server/scripts/match.py b/configs/scripts/match.py similarity index 100% rename from feature_server/scripts/match.py rename to configs/scripts/match.py diff --git a/feature_server/scripts/medkit.py b/configs/scripts/medkit.py similarity index 100% rename from feature_server/scripts/medkit.py rename to configs/scripts/medkit.py diff --git a/feature_server/scripts/memcheck.py b/configs/scripts/memcheck.py similarity index 100% rename from feature_server/scripts/memcheck.py rename to configs/scripts/memcheck.py diff --git a/feature_server/scripts/minefield.py b/configs/scripts/minefield.py similarity index 100% rename from feature_server/scripts/minefield.py rename to configs/scripts/minefield.py diff --git a/feature_server/scripts/paint.py b/configs/scripts/paint.py similarity index 100% rename from feature_server/scripts/paint.py rename to configs/scripts/paint.py diff --git a/feature_server/scripts/passreload.py b/configs/scripts/passreload.py similarity index 100% rename from feature_server/scripts/passreload.py rename to configs/scripts/passreload.py diff --git a/feature_server/scripts/platform.py b/configs/scripts/platform.py similarity index 100% rename from feature_server/scripts/platform.py rename to configs/scripts/platform.py diff --git a/feature_server/scripts/protect.py b/configs/scripts/protect.py similarity index 100% rename from feature_server/scripts/protect.py rename to configs/scripts/protect.py diff --git a/feature_server/scripts/query.py b/configs/scripts/query.py similarity index 100% rename from feature_server/scripts/query.py rename to configs/scripts/query.py diff --git a/feature_server/scripts/rampage.py b/configs/scripts/rampage.py similarity index 100% rename from feature_server/scripts/rampage.py rename to configs/scripts/rampage.py diff --git a/feature_server/scripts/rangedamage.py b/configs/scripts/rangedamage.py similarity index 100% rename from feature_server/scripts/rangedamage.py rename to configs/scripts/rangedamage.py diff --git a/feature_server/scripts/rapid.py b/configs/scripts/rapid.py similarity index 100% rename from feature_server/scripts/rapid.py rename to configs/scripts/rapid.py diff --git a/feature_server/scripts/ratio.py b/configs/scripts/ratio.py similarity index 100% rename from feature_server/scripts/ratio.py rename to configs/scripts/ratio.py diff --git a/feature_server/scripts/rollback.py b/configs/scripts/rollback.py similarity index 100% rename from feature_server/scripts/rollback.py rename to configs/scripts/rollback.py diff --git a/feature_server/scripts/runningman.py b/configs/scripts/runningman.py similarity index 100% rename from feature_server/scripts/runningman.py rename to configs/scripts/runningman.py diff --git a/feature_server/scripts/savemap.py b/configs/scripts/savemap.py similarity index 100% rename from feature_server/scripts/savemap.py rename to configs/scripts/savemap.py diff --git a/feature_server/scripts/spawn_protect.py b/configs/scripts/spawn_protect.py similarity index 100% rename from feature_server/scripts/spawn_protect.py rename to configs/scripts/spawn_protect.py diff --git a/feature_server/scripts/squad.py b/configs/scripts/squad.py similarity index 100% rename from feature_server/scripts/squad.py rename to configs/scripts/squad.py diff --git a/feature_server/scripts/stats.py b/configs/scripts/stats.py similarity index 100% rename from feature_server/scripts/stats.py rename to configs/scripts/stats.py diff --git a/feature_server/scripts/strongblock.py b/configs/scripts/strongblock.py similarity index 100% rename from feature_server/scripts/strongblock.py rename to configs/scripts/strongblock.py diff --git a/feature_server/scripts/tdm.py b/configs/scripts/tdm.py similarity index 100% rename from feature_server/scripts/tdm.py rename to configs/scripts/tdm.py diff --git a/feature_server/scripts/tow.py b/configs/scripts/tow.py similarity index 100% rename from feature_server/scripts/tow.py rename to configs/scripts/tow.py diff --git a/feature_server/scripts/trusted.py b/configs/scripts/trusted.py similarity index 100% rename from feature_server/scripts/trusted.py rename to configs/scripts/trusted.py diff --git a/feature_server/scripts/votekick.py b/configs/scripts/votekick.py similarity index 100% rename from feature_server/scripts/votekick.py rename to configs/scripts/votekick.py diff --git a/feature_server/scripts/votemap.py b/configs/scripts/votemap.py similarity index 100% rename from feature_server/scripts/votemap.py rename to configs/scripts/votemap.py diff --git a/feature_server/scripts/welcome.py b/configs/scripts/welcome.py similarity index 100% rename from feature_server/scripts/welcome.py rename to configs/scripts/welcome.py diff --git a/feature_server/scripts/zoc.py b/configs/scripts/zoc.py similarity index 100% rename from feature_server/scripts/zoc.py rename to configs/scripts/zoc.py diff --git a/feature_server/map.py b/feature_server/map.py index 33adb9d3..e849a77e 100644 --- a/feature_server/map.py +++ b/feature_server/map.py @@ -22,8 +22,6 @@ import math import random -# load dir is overridden to use resource directory in run.py -DEFAULT_LOAD_DIR = './maps' class MapNotFound(Exception): def __init__(self, map): @@ -33,7 +31,7 @@ def __init__(self, map): def __nonzero__(self): return False -def check_rotation(maps, load_dir = DEFAULT_LOAD_DIR): +def check_rotation(maps, load_dir): infos = [] for map in maps: if type(map) is not RotationInfo: @@ -45,7 +43,7 @@ def check_rotation(maps, load_dir = DEFAULT_LOAD_DIR): return infos class Map(object): - def __init__(self, rot_info, load_dir = DEFAULT_LOAD_DIR): + def __init__(self, rot_info, load_dir): self.load_information(rot_info, load_dir) if self.gen_script: @@ -55,13 +53,14 @@ def __init__(self, rot_info, load_dir = DEFAULT_LOAD_DIR): self.data = self.gen_script(rot_info.name, rot_info.get_seed()) else: print "Loading map '%s'..." % self.name - self.load_vxl(rot_info, load_dir) + self.load_vxl(rot_info) print 'Map loaded successfully.' def load_information(self, rot_info, load_dir): + self.load_dir = load_dir try: - info = imp.load_source(rot_info.name, rot_info.get_meta_filename()) + info = imp.load_source(rot_info.name, rot_info.get_meta_filename(load_dir)) except IOError: info = None self.info = info @@ -92,9 +91,9 @@ def apply_script(self, protocol, connection, config): protocol, connection = self.script(protocol, connection, config) return protocol, connection - def load_vxl(self, rot_info, load_dir): + def load_vxl(self, rot_info): try: - fp = open(rot_info.get_map_filename(load_dir), 'rb') + fp = open(rot_info.get_map_filename(self.load_dir), 'rb') except OSError: raise MapNotFound(rot_info.name) self.data = VXLData(fp) @@ -117,10 +116,10 @@ def get_seed(self): self.seed = random.randint(0, math.pow(2, 31)) return self.seed - def get_map_filename(self, load_dir = DEFAULT_LOAD_DIR): + def get_map_filename(self, load_dir): return os.path.join(load_dir, '%s.vxl' % self.name) - def get_meta_filename(self, load_dir = DEFAULT_LOAD_DIR): + def get_meta_filename(self, load_dir): return os.path.join(load_dir, '%s.txt' % self.name) def __str__(self): diff --git a/feature_server/run.py b/feature_server/run.py index 5f7d4f87..ad438ea1 100644 --- a/feature_server/run.py +++ b/feature_server/run.py @@ -33,12 +33,12 @@ arg_parser = argparse.ArgumentParser(prog="pysnip", description="PySnip is an open-source Python server implementation for the voxel-based game \"Ace of Spades\".") -arg_parser.add_argument("-c","--config-file", default="config.txt", - help="Specify alternate config file (default is feature_server/config.txt).") +arg_parser.add_argument("-c","--config-file", default="config.json", + help="Specify alternate config file relative to config dir.") arg_parser.add_argument("-j","--json-parameters", help="Add extra json parameters, overwriting that in config file.") -arg_parser.add_argument("-r","--resource-dir", default=".", - help="The directory which contains maps,scripts,etc (in correctly named subdirs). - default is in directory of run.py, in feature_server.") +arg_parser.add_argument("-d","--config-dir", default=os.path.join(os.path.expanduser("~"), ".pysnip"), + help="The directory which contains maps,scripts,etc (in correctly named subdirs). - default is ~/.pysnip/.") args = arg_parser.parse_args() @@ -49,10 +49,14 @@ def choose_path(base,top): return os.path.join(base,top) return top -# ok, so we use the resource directory to search for maps, etc. (alternative to the feature_server dir) -RESOURCE_DIR = args.resource_dir +# ok, so we use the resource directory to search for maps, etc. +config_dir = args.config_dir + +# add it to the path so we can import scripts +sys.path.append(config_dir) + # fix the path for the config file - handles differering directories and relative or absolute paths -CONFIG_FILE = choose_path(RESOURCE_DIR,args.config_file) +config_file = choose_path(config_dir,args.config_file) # default passwords hardcoded in config DEFAULT_PASSWORDS = { @@ -62,17 +66,13 @@ def choose_path(base,top): 'trusted' : ['trustedpass'] } -for index, name in enumerate((CONFIG_FILE, 'config.txt.default')): - try: - config = json.load(open(name, 'rb')) - if index != 0: - print '(creating config.txt from %s)' % name - shutil.copy(name, CONFIG_FILE) - break - except IOError, e: - pass -else: - raise SystemExit('no config file found') +try: + with open(config_file, 'rb') as f: + config = json.load(f) +except IOError as e: + print(config_file) + print("Error reading config: ", e) + sys.exit(1) # update with parameters from args if args.json_parameters: @@ -589,7 +589,7 @@ def __init__(self, interface, config): self.win_count = itertools.count(1) self.bans = NetworkDict() try: - self.bans.read_list(json.load(open(os.path.join(RESOURCE_DIR,'bans.txt'), 'rb'))) + self.bans.read_list(json.load(open(os.path.join(config_dir,'bans.txt'), 'rb'))) except IOError: pass self.hard_bans = set() # possible DDoS'ers are added here @@ -640,7 +640,7 @@ def __init__(self, interface, config): self.set_god_build = config.get('set_god_build', False) self.debug_log = config.get('debug_log', False) if self.debug_log: - pyspades.debug.open_debug_log(os.path.join(RESOURCE_DIR,'debug.log')) + pyspades.debug.open_debug_log(os.path.join(config_dir,'debug.log')) ssh = config.get('ssh', {}) if ssh.get('enabled', False): from ssh import RemoteConsole @@ -661,9 +661,10 @@ def __init__(self, interface, config): if ban_subscribe.get('enabled', True): import bansubscribe self.ban_manager = bansubscribe.BanManager(self, ban_subscribe) + # logfile location in resource dir if not abs path given - logfile = choose_path(RESOURCE_DIR,config.get('logfile', None)) - if logfile is not None and logfile.strip(): + logfile = choose_path(config_dir,config.get('logfile', '')) + if logfile.strip(): # catches empty filename if config.get('rotate_daily', False): create_filename_path(logfile) logging_file = DailyLogFile(logfile, '.') @@ -791,11 +792,11 @@ def set_map_name(self, rot_info): return True def get_map(self, rot_info): - return Map(rot_info, os.path.join(RESOURCE_DIR,'maps')) + return Map(rot_info, os.path.join(config_dir,'maps')) def set_map_rotation(self, maps, now = True): try: - maps = check_rotation(maps, os.path.join(RESOURCE_DIR,'maps')) + maps = check_rotation(maps, os.path.join(config_dir,'maps')) except MapNotFound, e: return e self.maps = maps @@ -917,7 +918,7 @@ def undo_last_ban(self): return result def save_bans(self): - json.dump(self.bans.make_list(), open_create(os.path.join(RESOURCE_DIR,'bans.txt'), 'wb')) + json.dump(self.bans.make_list(), open_create(os.path.join(config_dir,'bans.txt'), 'wb')) if self.ban_publish is not None: self.ban_publish.update() @@ -1051,10 +1052,6 @@ def get_advance_time(self): script_names.append(game_mode) -# temporarily allow loading from the scripts folder in the resource directory -ORIG_PATH = sys.path -sys.path = [RESOURCE_DIR] + ORIG_PATH - for script in script_names[:]: try: module = __import__('scripts.%s' % script, globals(), locals(), @@ -1064,9 +1061,6 @@ def get_advance_time(self): print "(script '%s' not found: %r)" % (script, e) script_names.remove(script) -# change back to original path -sys.path = ORIG_PATH - for script in script_objects: protocol_class, connection_class = script.apply_script(protocol_class, From dd4e1b647e1013c627d1d24a8d2061f2830e833a Mon Sep 17 00:00:00 2001 From: Samuel Walladge Date: Sat, 12 Mar 2016 11:20:16 +1030 Subject: [PATCH 02/12] updated readme --- README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fdc965f3..b67ee612 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,18 @@ -![PySnip](http://i.imgur.com/QFgqcRM.png) -[![Build Status](https://travis-ci.org/NateShoffner/PySnip.svg?branch=master)](https://travis-ci.org/NateShoffner/PySnip) +# About this fork # + +This fork has been created with the aim to complete the following: + +- separate server from configs/maps/scripts/etc (at the moment it's all combined, and messy) +- force all config/maps/logs/scripts to be loaded from a single configs directory (default ~/.pysnip/) +- make it installable via pip or a linux package manager +- port to python3 +- keep up to date and fix any bugs (please send pull requests!) + + +# Original README below # + +![PySnip](http://i.imgur.com/QFgqcRM.png) PySnip is an robust, open-source and cross-platform server implementation for [Ace of Spades](http://buildandshoot.com). It is fully customizable with extensions and scripts. From 8d1ddb9a07bf3f1085da796da24b57a0e5153423 Mon Sep 17 00:00:00 2001 From: Samuel Walladge Date: Sat, 12 Mar 2016 13:41:13 +1030 Subject: [PATCH 03/12] more moving files around and added readme for config dir --- README.md | 1 + configs/README.md | 76 +++++++++++++++++++ {contrib => configs}/scripts/aimblock.py | 0 {contrib => configs}/scripts/aimbot2.py | 0 {contrib => configs}/scripts/arena.py | 0 {contrib => configs}/scripts/babel.py | 0 {contrib => configs}/scripts/badmin.py | 0 {contrib => configs}/scripts/dynfog.py | 0 {contrib => configs}/scripts/freeforall.py | 0 .../scripts/mapmakingtools.py | 0 {contrib => configs}/scripts/onectf.py | 0 {contrib => configs}/scripts/smartnade.py | 0 .../scripts/spectatorcontrol.py | 0 {contrib => configs}/scripts/timedmute.py | 0 contrib/scripts/README.txt | 1 - 15 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 configs/README.md rename {contrib => configs}/scripts/aimblock.py (100%) rename {contrib => configs}/scripts/aimbot2.py (100%) rename {contrib => configs}/scripts/arena.py (100%) rename {contrib => configs}/scripts/babel.py (100%) rename {contrib => configs}/scripts/badmin.py (100%) rename {contrib => configs}/scripts/dynfog.py (100%) rename {contrib => configs}/scripts/freeforall.py (100%) rename {contrib => configs}/scripts/mapmakingtools.py (100%) rename {contrib => configs}/scripts/onectf.py (100%) rename {contrib => configs}/scripts/smartnade.py (100%) rename {contrib => configs}/scripts/spectatorcontrol.py (100%) rename {contrib => configs}/scripts/timedmute.py (100%) delete mode 100644 contrib/scripts/README.txt diff --git a/README.md b/README.md index b67ee612..0a45af7a 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ This fork has been created with the aim to complete the following: - make it installable via pip or a linux package manager - port to python3 - keep up to date and fix any bugs (please send pull requests!) +- provide some more documentation on how to instal, run, and configure the server # Original README below # diff --git a/configs/README.md b/configs/README.md new file mode 100644 index 00000000..1200bd47 --- /dev/null +++ b/configs/README.md @@ -0,0 +1,76 @@ +# Config directory + +Structure as follows: + +``` +. +├── config.json # default config file +├── config.json.default # backup config file +├── logs # logs directory +│   └── log.txt # default logfile +├── maps # maps in .txt generate script form or .vxl data +│   ├── classicgen.txt +│   └── random.txt +├── README.md +└── scripts + ├── __init__.py + ├── afk.py + ├── aimblock.py + ├── aimbot2.py + ├── airstrike.py + ├── antijerk.py + ├── arena.py + ├── autohelp.py + ├── babel.py + ├── badmin.py + ├── blockinfo.py + ├── bugfix.py + ├── commandhelp.py + ├── daycycle.py + ├── demolitionman.py + ├── dirtnade.py + ├── disco.py + ├── disco.pyc + ├── dynfog.py + ├── fbpatch.py + ├── flagreturn.py + ├── freeforall.py + ├── grownade.py + ├── infiltration.py + ├── map_extensions.py + ├── mapmakingtools.py + ├── markers.py + ├── match.py + ├── medkit.py + ├── memcheck.py + ├── minefield.py + ├── onectf.py + ├── paint.py + ├── passreload.py + ├── platform.py + ├── protect.py + ├── query.py + ├── rampage.py + ├── rangedamage.py + ├── rapid.py + ├── ratio.py + ├── ratio.pyc + ├── rollback.py + ├── runningman.py + ├── savemap.py + ├── smartnade.py + ├── spawn_protect.py + ├── spectatorcontrol.py + ├── squad.py + ├── stats.py + ├── strongblock.py + ├── tdm.py + ├── timedmute.py + ├── tow.py + ├── trusted.py + ├── votekick.py + ├── votemap.py + ├── welcome.py + └── zoc.py +``` + diff --git a/contrib/scripts/aimblock.py b/configs/scripts/aimblock.py similarity index 100% rename from contrib/scripts/aimblock.py rename to configs/scripts/aimblock.py diff --git a/contrib/scripts/aimbot2.py b/configs/scripts/aimbot2.py similarity index 100% rename from contrib/scripts/aimbot2.py rename to configs/scripts/aimbot2.py diff --git a/contrib/scripts/arena.py b/configs/scripts/arena.py similarity index 100% rename from contrib/scripts/arena.py rename to configs/scripts/arena.py diff --git a/contrib/scripts/babel.py b/configs/scripts/babel.py similarity index 100% rename from contrib/scripts/babel.py rename to configs/scripts/babel.py diff --git a/contrib/scripts/badmin.py b/configs/scripts/badmin.py similarity index 100% rename from contrib/scripts/badmin.py rename to configs/scripts/badmin.py diff --git a/contrib/scripts/dynfog.py b/configs/scripts/dynfog.py similarity index 100% rename from contrib/scripts/dynfog.py rename to configs/scripts/dynfog.py diff --git a/contrib/scripts/freeforall.py b/configs/scripts/freeforall.py similarity index 100% rename from contrib/scripts/freeforall.py rename to configs/scripts/freeforall.py diff --git a/contrib/scripts/mapmakingtools.py b/configs/scripts/mapmakingtools.py similarity index 100% rename from contrib/scripts/mapmakingtools.py rename to configs/scripts/mapmakingtools.py diff --git a/contrib/scripts/onectf.py b/configs/scripts/onectf.py similarity index 100% rename from contrib/scripts/onectf.py rename to configs/scripts/onectf.py diff --git a/contrib/scripts/smartnade.py b/configs/scripts/smartnade.py similarity index 100% rename from contrib/scripts/smartnade.py rename to configs/scripts/smartnade.py diff --git a/contrib/scripts/spectatorcontrol.py b/configs/scripts/spectatorcontrol.py similarity index 100% rename from contrib/scripts/spectatorcontrol.py rename to configs/scripts/spectatorcontrol.py diff --git a/contrib/scripts/timedmute.py b/configs/scripts/timedmute.py similarity index 100% rename from contrib/scripts/timedmute.py rename to configs/scripts/timedmute.py diff --git a/contrib/scripts/README.txt b/contrib/scripts/README.txt deleted file mode 100644 index fc5610e1..00000000 --- a/contrib/scripts/README.txt +++ /dev/null @@ -1 +0,0 @@ -This contrib sub-directory contains user-made scripts. \ No newline at end of file From e00a5ddc23912f26f68bbbc21566478490937282 Mon Sep 17 00:00:00 2001 From: Samuel Walladge Date: Sat, 12 Mar 2016 13:56:35 +1030 Subject: [PATCH 04/12] updated readme in configs directory --- configs/README.md | 71 +++++++---------------------------------------- 1 file changed, 10 insertions(+), 61 deletions(-) diff --git a/configs/README.md b/configs/README.md index 1200bd47..4714f034 100644 --- a/configs/README.md +++ b/configs/README.md @@ -4,73 +4,22 @@ Structure as follows: ``` . -├── config.json # default config file -├── config.json.default # backup config file +├── config.json # default config file if no file specified +├── config.json.default # backup config file (same as config.json as supplied) ├── logs # logs directory -│   └── log.txt # default logfile +│   └── log.txt # default server logfile ├── maps # maps in .txt generate script form or .vxl data -│   ├── classicgen.txt -│   └── random.txt -├── README.md -└── scripts - ├── __init__.py - ├── afk.py - ├── aimblock.py +│   ├── classicgen.txt # includes a couple of simple maps - add any maps you want to use here +│   └── ... +└── scripts # contains all scripts and extensions - load by adding name to script list in config + ├── __init__.py # don't delete this - needed so python can import scripts for this directory + ├── afk.py # huge number of scripts included - see each file for more information, instructions, and attributions + ├── aimblock.py # place any other scripts you want to use in this directory ├── aimbot2.py ├── airstrike.py ├── antijerk.py ├── arena.py ├── autohelp.py - ├── babel.py - ├── badmin.py - ├── blockinfo.py - ├── bugfix.py - ├── commandhelp.py - ├── daycycle.py - ├── demolitionman.py - ├── dirtnade.py - ├── disco.py - ├── disco.pyc - ├── dynfog.py - ├── fbpatch.py - ├── flagreturn.py - ├── freeforall.py - ├── grownade.py - ├── infiltration.py - ├── map_extensions.py - ├── mapmakingtools.py - ├── markers.py - ├── match.py - ├── medkit.py - ├── memcheck.py - ├── minefield.py - ├── onectf.py - ├── paint.py - ├── passreload.py - ├── platform.py - ├── protect.py - ├── query.py - ├── rampage.py - ├── rangedamage.py - ├── rapid.py - ├── ratio.py - ├── ratio.pyc - ├── rollback.py - ├── runningman.py - ├── savemap.py - ├── smartnade.py - ├── spawn_protect.py - ├── spectatorcontrol.py - ├── squad.py - ├── stats.py - ├── strongblock.py - ├── tdm.py - ├── timedmute.py - ├── tow.py - ├── trusted.py - ├── votekick.py - ├── votemap.py - ├── welcome.py - └── zoc.py + └── ... ``` From 85ea40e7e705c850eed296445046f565cd86b246 Mon Sep 17 00:00:00 2001 From: Samuel Walladge Date: Sat, 12 Mar 2016 14:17:53 +1030 Subject: [PATCH 05/12] added support for global configuration object, geolocation data file now loads from config directory --- .gitignore | 4 +--- feature_server/cfg.py | 10 ++++++++++ feature_server/commands.py | 5 ++++- feature_server/data/dummy | 0 feature_server/run.py | 5 +++++ 5 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 feature_server/cfg.py delete mode 100644 feature_server/data/dummy diff --git a/.gitignore b/.gitignore index 73cf71da..6a2ad957 100644 --- a/.gitignore +++ b/.gitignore @@ -23,12 +23,10 @@ build/ enet/build/ venv/ -# feature server -feature_server/data/ - # config/userdata configs/maps/*.txtc configs/logs/ +configs/data/ # py2exe py2exe/dist/ diff --git a/feature_server/cfg.py b/feature_server/cfg.py new file mode 100644 index 00000000..680b95f5 --- /dev/null +++ b/feature_server/cfg.py @@ -0,0 +1,10 @@ + +# to have global configuration variables +# similar to http://effbot.org/pyfaq/how-do-i-share-global-variables-across-modules.htm + +import os + +config = {} +config_dir = os.path.join(os.path.expanduser("~"), ".pysnip") +config_file = 'config.json' + diff --git a/feature_server/commands.py b/feature_server/commands.py index b8ebffb8..a4a9a728 100644 --- a/feature_server/commands.py +++ b/feature_server/commands.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with pyspades. If not, see . +import os import math from random import choice from pyspades.constants import * @@ -24,6 +25,8 @@ from map import check_rotation +import cfg + class InvalidPlayer(Exception): pass @@ -932,7 +935,7 @@ def add(func, name = None): # optional commands try: import pygeoip - database = pygeoip.GeoIP('./data/GeoLiteCity.dat') + database = pygeoip.GeoIP(os.path.join(cfg.config_dir, 'data/GeoLiteCity.dat')) @name('from') def where_from(connection, value = None): diff --git a/feature_server/data/dummy b/feature_server/data/dummy deleted file mode 100644 index e69de29b..00000000 diff --git a/feature_server/run.py b/feature_server/run.py index ad438ea1..d2627b19 100644 --- a/feature_server/run.py +++ b/feature_server/run.py @@ -30,6 +30,8 @@ import argparse +import cfg + arg_parser = argparse.ArgumentParser(prog="pysnip", description="PySnip is an open-source Python server implementation for the voxel-based game \"Ace of Spades\".") @@ -51,12 +53,14 @@ def choose_path(base,top): # ok, so we use the resource directory to search for maps, etc. config_dir = args.config_dir +cfg.config_dir = config_dir # add it to the path so we can import scripts sys.path.append(config_dir) # fix the path for the config file - handles differering directories and relative or absolute paths config_file = choose_path(config_dir,args.config_file) +cfg.config_file = config_file # default passwords hardcoded in config DEFAULT_PASSWORDS = { @@ -69,6 +73,7 @@ def choose_path(base,top): try: with open(config_file, 'rb') as f: config = json.load(f) + cfg.config = config except IOError as e: print(config_file) print("Error reading config: ", e) From e7eb22cda0875a2494fabf8b093c1373aff5c88d Mon Sep 17 00:00:00 2001 From: Samuel Walladge Date: Sat, 12 Mar 2016 14:31:30 +1030 Subject: [PATCH 06/12] updated travis build stuff --- .travis.yml | 10 ++-------- README.md | 2 ++ requirements.txt | 7 +++++++ 3 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 requirements.txt diff --git a/.travis.yml b/.travis.yml index 9fc5e879..e9487b3e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,13 +4,7 @@ python: - 2.7 install: - - pip install cython - - pip install twisted - - pip install jinja2 - - pip install pillow - - pip install pygeoip - - pip install pycrypto - - pip install pyasn1 + - pip install -r requirements.txt script: - - sh build.sh \ No newline at end of file + - sh build.sh diff --git a/README.md b/README.md index 0a45af7a..a4385f3d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # About this fork # +[![Build Status](https://travis-ci.org/swalladge/PySnip.svg?branch=master)](https://travis-ci.org/swalladge/PySnip) + This fork has been created with the aim to complete the following: - separate server from configs/maps/scripts/etc (at the moment it's all combined, and messy) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..be2d6401 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,7 @@ +cython +twisted +jinja2 +pillow +pygeoip +pycrypto +pyasn1 From e42e414ca85744360b5099c542d8092a64fdcdd4 Mon Sep 17 00:00:00 2001 From: Samuel Walladge Date: Sat, 12 Mar 2016 15:01:19 +1030 Subject: [PATCH 07/12] added info about geolitecity to readme --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a4385f3d..a1d3bffe 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Build Status](https://travis-ci.org/swalladge/PySnip.svg?branch=master)](https://travis-ci.org/swalladge/PySnip) -This fork has been created with the aim to complete the following: +This fork (original project at [NateSchoffner/PySnip](https://github.com/NateShoffner/PySnip)) has been created with the aim to complete the following: - separate server from configs/maps/scripts/etc (at the moment it's all combined, and messy) - force all config/maps/logs/scripts to be loaded from a single configs directory (default ~/.pysnip/) @@ -13,6 +13,18 @@ This fork has been created with the aim to complete the following: - provide some more documentation on how to instal, run, and configure the server +## FAQs + +### `('from' command disabled - missing data/GeoLiteCity.dat)` in server log + +You need to download a `GeoLiteCity.dat` into the data directory in your config directory. + +A script is included to help - Just run the following: +``` +cd ~/.pysnip/ +/path/to/pysnip/feature_server/update_geoip.py +``` + # Original README below # ![PySnip](http://i.imgur.com/QFgqcRM.png) From f421108d35c49b8bd4dc2e01164bca7f7083b19f Mon Sep 17 00:00:00 2001 From: Samuel Walladge Date: Sat, 12 Mar 2016 15:33:27 +1030 Subject: [PATCH 08/12] converted web template to unix line endings --- configs/config.json | 8 +- feature_server/web/templates/status.html | 182 ++++++++++++++++++++++- 2 files changed, 185 insertions(+), 5 deletions(-) diff --git a/configs/config.json b/configs/config.json index bc23d784..f93ba1f1 100644 --- a/configs/config.json +++ b/configs/config.json @@ -23,7 +23,7 @@ "rules" : [ "Cheating isn't welcome. Griefing is frowned upon. Have fun!" ], - "master" : true, + "master" : false, "max_players" : 32, "max_connections_per_ip" : 3, "port" : 32887, @@ -96,9 +96,9 @@ } }, "status_server" : { - "enabled" : false, + "enabled" : true, "port" : 32886, - "logging" : false + "logging" : true }, "ban_publish" : { "enabled" : false, @@ -143,4 +143,4 @@ "load_saved_map" : false, "rollback_on_game_end" : false, "afk_time_limit" : 30 -} \ No newline at end of file +} diff --git a/feature_server/web/templates/status.html b/feature_server/web/templates/status.html index 260e10b6..d306faab 100644 --- a/feature_server/web/templates/status.html +++ b/feature_server/web/templates/status.html @@ -1 +1,181 @@ - {{server.name}}

Server Details:

Game Mode: {{server.game_mode_name}}
Map: {{server.map_info.name}} v{{server.map_info.version}}
Map: {{server.map_info.author}}
Uptime:
Enabled Scripts: {{ ', '.join(server.config['scripts'])}}

Players: ({{server.connections|count}}/{{server.max_players}})

{% for player in server.players.values() %} {% endfor %}
Name Latency (ms) Team Kills
{{player.name}} {{player.latency}} {{player.team.name}} {{player.kills}}

Map Overview:

\ No newline at end of file + + + + + {{server.name}} + + + + + + + + + + + + +
+
+
+ + +

Server Details:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Game Mode:{{server.game_mode_name}}
Map:{{server.map_info.name}} v{{server.map_info.version}}
Map:{{server.map_info.author}}
Uptime:
Enabled Scripts:{{ ', '.join(server.config['scripts'])}}
+ + +

Players: ({{server.connections|count}}/{{server.max_players}})

+ + + + + + + + + + + {% for player in server.players.values() %} + + + + + + + {% endfor %} + +
NameLatency (ms)TeamKills
{{player.name}}{{player.latency}}{{player.team.name}}{{player.kills}}
+ + +

Map Overview:

+ +
+
+
+ + + + + + From a05238bb11d0baf20af56438d5de7ab1dc2ca94b Mon Sep 17 00:00:00 2001 From: Samuel Walladge Date: Sat, 12 Mar 2016 15:43:52 +1030 Subject: [PATCH 09/12] updated readme, worked on config file loading --- README.md | 3 +-- feature_server/run.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a1d3bffe..bd507005 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,7 @@ This fork (original project at [NateSchoffner/PySnip](https://github.com/NateShoffner/PySnip)) has been created with the aim to complete the following: -- separate server from configs/maps/scripts/etc (at the moment it's all combined, and messy) -- force all config/maps/logs/scripts to be loaded from a single configs directory (default ~/.pysnip/) +- [DONE] separate server from configs/maps/scripts/etc (at the moment it's all combined, and messy) - make it installable via pip or a linux package manager - port to python3 - keep up to date and fix any bugs (please send pull requests!) diff --git a/feature_server/run.py b/feature_server/run.py index d2627b19..8e516ba0 100644 --- a/feature_server/run.py +++ b/feature_server/run.py @@ -36,11 +36,11 @@ description="PySnip is an open-source Python server implementation for the voxel-based game \"Ace of Spades\".") arg_parser.add_argument("-c","--config-file", default="config.json", - help="Specify alternate config file relative to config dir.") + help="specify alternate config file (relative to config dir if relative path)") arg_parser.add_argument("-j","--json-parameters", - help="Add extra json parameters, overwriting that in config file.") + help="add extra json parameters, overwriting that in config file") arg_parser.add_argument("-d","--config-dir", default=os.path.join(os.path.expanduser("~"), ".pysnip"), - help="The directory which contains maps,scripts,etc (in correctly named subdirs). - default is ~/.pysnip/.") + help="he directory which contains maps,scripts,etc (in correctly named subdirs) - default is ~/.pysnip/") args = arg_parser.parse_args() @@ -75,9 +75,12 @@ def choose_path(base,top): config = json.load(f) cfg.config = config except IOError as e: - print(config_file) - print("Error reading config: ", e) + print("Error reading config from {}: ".format(config_file) + str(e)) sys.exit(1) +except ValueError as e: + print("Error in config file {}: ".format(config_file) + str(e)) + sys.exit(1) + # update with parameters from args if args.json_parameters: From a1e7d41774ba02ab84f40f18fd23f3afa79a3e58 Mon Sep 17 00:00:00 2001 From: Samuel Walladge Date: Mon, 14 Mar 2016 16:03:22 +1030 Subject: [PATCH 10/12] added env to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6a2ad957..1304c24a 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ build/ enet/build/ venv/ +env/ # config/userdata configs/maps/*.txtc From 4d3520e6b7598f7e3ad7e74ce893c9b57790352a Mon Sep 17 00:00:00 2001 From: Samuel Walladge Date: Wed, 28 Dec 2016 21:05:01 +1030 Subject: [PATCH 11/12] fix readme --- README.md | 160 +++++++++++++++++++++++++----------------------------- 1 file changed, 74 insertions(+), 86 deletions(-) diff --git a/README.md b/README.md index bd507005..be984afb 100644 --- a/README.md +++ b/README.md @@ -1,86 +1,74 @@ - -# About this fork # - -[![Build Status](https://travis-ci.org/swalladge/PySnip.svg?branch=master)](https://travis-ci.org/swalladge/PySnip) - -This fork (original project at [NateSchoffner/PySnip](https://github.com/NateShoffner/PySnip)) has been created with the aim to complete the following: - -- [DONE] separate server from configs/maps/scripts/etc (at the moment it's all combined, and messy) -- make it installable via pip or a linux package manager -- port to python3 -- keep up to date and fix any bugs (please send pull requests!) -- provide some more documentation on how to instal, run, and configure the server - - -## FAQs - -### `('from' command disabled - missing data/GeoLiteCity.dat)` in server log - -You need to download a `GeoLiteCity.dat` into the data directory in your config directory. - -A script is included to help - Just run the following: -``` -cd ~/.pysnip/ -/path/to/pysnip/feature_server/update_geoip.py -``` - -# Original README below # - -![PySnip](http://i.imgur.com/QFgqcRM.png) - -PySnip is an robust, open-source and cross-platform server implementation for [Ace of Spades](http://buildandshoot.com). It is fully customizable with extensions and scripts. - -### Features ### - -* Many administrator features -* A lot of epic commands -* A remote console (using SSH) -* Map rotation -* Map metadata (name, version, author, and map configuration) -* Map extensions (water damage, etc.) -* A map generator -* An IRC client for managing your server -* A JSON query webserver -* A status server with map overview -* Server/map scripts -* Airstrikes -* Melee attacks with the pickaxe -* New gamemodes (deathmatch / runningman) -* Rollback feature (rolling back to the original map) -* Spectator mode -* Dirt grenades -* Platforms with buttons -* Ban subscribe service -* A ton of other features - -### Installing ### -#### For windows #### -Go to [releases](https://github.com/NateShoffner/PySnip/releases) and download desired version. - -#### For linux #### -Grab it from repo. -```bash -git clone https://github.com/NateShoffner/PySnip -cd PySnip -``` -Create virtualenv -```bash -virtualenv -p python2 venv -source ./venv/bin/activate -``` -Install dependencies -```bash -pip install cython twisted jinja2 pillow pygeoip pycrypto pyasn1 -``` -Compile -```bash -./build.sh -``` -Run -```bash -./run_server.sh -``` - -### Support ### - -Feel free to post a question on the [forums](http://buildandshoot.com/viewforum.php?f=19) if you need any help or hop onto [IRC](http://webchat.quakenet.org/?channels=%23buildandshoot) to to chat. +![PySnip](http://i.imgur.com/QFgqcRM.png) + +[![Build Status](https://travis-ci.org/NateShoffner/PySnip.svg?branch=master)](https://travis-ci.org/NateShoffner/PySnip) + +PySnip is an robust, open-source and cross-platform server implementation for [Ace of Spades](http://buildandshoot.com). It is fully customizable with extensions and scripts. + +### Features ### + +* Many administrator features +* A lot of epic commands +* A remote console (using SSH) +* Map rotation +* Map metadata (name, version, author, and map configuration) +* Map extensions (water damage, etc.) +* A map generator +* An IRC client for managing your server +* A JSON query webserver +* A status server with map overview +* Server/map scripts +* Airstrikes +* Melee attacks with the pickaxe +* New gamemodes (deathmatch / runningman) +* Rollback feature (rolling back to the original map) +* Spectator mode +* Dirt grenades +* Platforms with buttons +* Ban subscribe service +* A ton of other features + +### Installing ### +#### For windows #### +Go to [releases](https://github.com/NateShoffner/PySnip/releases) and download desired version. + +#### For linux #### +Grab it from repo. +```bash +git clone https://github.com/NateShoffner/PySnip +cd PySnip +``` +Create virtualenv +```bash +virtualenv -p python2 venv +source ./venv/bin/activate +``` +Install dependencies +```bash +pip install cython twisted jinja2 pillow pygeoip pycrypto pyasn1 +``` +Compile +```bash +./build.sh +``` +Run +```bash +./run_server.sh +``` + +### FAQs + +#### GeoLiteCity.dat error + +If you get the error: `('from' command disabled - missing data/GeoLiteCity.dat)` in the server log, you will need to +download a `GeoLiteCity.dat` file into the data directory in your config directory. + +A script is included to automate this - run the following: + +``` +cd ~/.pysnip/ +/path/to/pysnip/feature_server/update_geoip.py +``` + +### Support ### + +Feel free to post a question on the [forums](http://buildandshoot.com/viewforum.php?f=19) if you need any help or hop onto [IRC](http://webchat.quakenet.org/?channels=%23buildandshoot) to to chat. From b248c7c12e2b791389ed2280496302a1e8830bfc Mon Sep 17 00:00:00 2001 From: Samuel Walladge Date: Wed, 28 Dec 2016 21:10:09 +1030 Subject: [PATCH 12/12] fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index be984afb..c88e923f 100644 --- a/README.md +++ b/README.md @@ -71,4 +71,4 @@ cd ~/.pysnip/ ### Support ### -Feel free to post a question on the [forums](http://buildandshoot.com/viewforum.php?f=19) if you need any help or hop onto [IRC](http://webchat.quakenet.org/?channels=%23buildandshoot) to to chat. +Feel free to post a question on the [forums](http://buildandshoot.com/viewforum.php?f=19) if you need any help or hop onto [IRC](http://webchat.quakenet.org/?channels=%23buildandshoot) to chat.