幫幫我 - translated to help me run a babel server

The original, free Ace of Spades game powered by the Voxlap engine. Known as “Classic,” 0.75, 0.76, and all 0.x versions. Created by Ben Aksoy.
8 posts Page 1 of 1 First unread post
amigodk
Deuce
Posts: 1
Joined: Sat Nov 16, 2013 9:14 am


我是台灣人 我非常喜歡玩黑桃A 可是這裡都只有英文 本人英文不好

我已經會架設Server了 可是我想玩通天塔 "babel" 這個模式

可是我Server開起來都是 ctf 這個模式

原本為"game_mode" : "ctf" 如果我更改"game_mode" : "babel"

Server就開不起來了

我想開一個babel的模式 請教我好嗎 謝謝!!!
ByteBit
Build and Shoot's 1st Birthday
Build and Shoot's 1st Birthday
Posts: 141
Joined: Sun Mar 24, 2013 12:08 pm


Speak english please
Last edited by ByteBit on Sat Nov 16, 2013 9:23 pm, edited 1 time in total.
PABH
Deuced Up
Posts: 261
Joined: Mon Nov 05, 2012 5:56 pm


黑鬼。
Space101
3 Years of Ace of Spades
3 Years of Ace of Spades
Posts: 92
Joined: Mon Nov 05, 2012 5:39 pm


herro chinaman
danhezee
Former Admin / Co-founder
Former Admin / Co-founder
Posts: 1710
Joined: Wed Oct 03, 2012 12:09 am


amigodk wrote:
我是台灣人 我非常喜歡玩黑桃A 可是這裡都只有英文 本人英文不好

我已經會架設Server了 可是我想玩通天塔 "babel" 這個模式

可是我Server開起來都是 ctf 這個模式

原本為"game_mode" : "ctf" 如果我更改"game_mode" : "babel"

Server就開不起來了

我想開一個babel的模式 請教我好嗎 謝謝!!!
I am a Taiwanese I really like to play Spades A, but here are just bad English I English

I have, but I would want to play the erection Server Babel "babel" this model

But I Server to open up this model are ctf

Originally "game_mode": "ctf" If I change "game_mode": "babel"

Server does not open up the

I want to open a babel mode ask me please thank you!!!
Fleischgeruch
Winter Celebration 2013
Winter Celebration 2013
Posts: 961
Joined: Tue Nov 06, 2012 6:15 pm


Make a server like that and I may just return to AoS.
ByteBit
Build and Shoot's 1st Birthday
Build and Shoot's 1st Birthday
Posts: 141
Joined: Sun Mar 24, 2013 12:08 pm


Better english:
Code: Select all
I am Taiwanese and I really like to play Ace of Spades, but here you'll have to speak English and
I'm very bad in it. Though I would want to start my own babel server. But when I change
"game_mode": "ctf" to "game_mode": "babel" it's still Capture the Flag. I want that babel mode!
Please tell me how to do that! Thank you!!!
danhezee
Former Admin / Co-founder
Former Admin / Co-founder
Posts: 1710
Joined: Wed Oct 03, 2012 12:09 am


you need to add "babel_script", "onectf" to scripts in the config.txt. Something like this:
Code: Select all
 "scripts" : [
"babel_script",
 "onectf"
  ],

you will also need to have babel_script.py and onectf.py in your scripts folder

onectf.py should be there below is babel_script.py:
Code: Select all
# babel.py
#
# Tower of Babel
# written by Yourself, modified by izzy
#
# how to use:
#
# save babel.py to 'scripts' folder
# save onectf.py to 'scripts' folder http://pyspades.googlecode.com/hg/contrib/scripts/onectf.py
# change line 15 in onectf.py to: ONE_CTF_MODE = ONE_CTF
# set game_mode to "ctf" in config.txt
# add "babel" to scripts list in config.txt
# add "onectf" to scripts list in config.txt
# set cap_limit to 10 in config.txt

from pyspades.constants import *
from random import randint
from twisted.internet import reactor
import commands

# If ALWAYS_ENABLED is False, then babel can be enabled by setting 'babel': True
# in the map metadat extensions dictionary.
ALWAYS_ENABLED = True

PLATFORM_WIDTH = 100
PLATFORM_HEIGHT = 32
PLATFORM_COLOR = (0, 255, 255, 255)
BLUE_BASE_COORDS = (256-138, 256)
GREEN_BASE_COORDS = (256+138, 256)
SPAWN_SIZE = 40

# Don't touch this stuff
PLATFORM_WIDTH /= 2
PLATFORM_HEIGHT /= 2
SPAWN_SIZE /= 2

def get_entity_location(self, entity_id):
    if entity_id == BLUE_BASE:
        return BLUE_BASE_COORDS + (self.protocol.map.get_z(*BLUE_BASE_COORDS),)
    elif entity_id == GREEN_BASE:
        return GREEN_BASE_COORDS + (self.protocol.map.get_z(*GREEN_BASE_COORDS),)
    elif entity_id == BLUE_FLAG:
        return (256 - PLATFORM_WIDTH + 1, 256, 0)
    elif entity_id == GREEN_FLAG:
        return (256 + PLATFORM_WIDTH - 1, 256, 0)

def get_spawn_location(connection):
    xb = connection.team.base.x
    yb = connection.team.base.y
    xb += randint(-SPAWN_SIZE, SPAWN_SIZE)
    yb += randint(-SPAWN_SIZE, SPAWN_SIZE)
    return (xb, yb, connection.protocol.map.get_z(xb, yb))

def coord_on_platform(x, y, z):
    if z <= 2:
        if x >= (256 - PLATFORM_WIDTH) and x <= (256 + PLATFORM_WIDTH) and y >= (256 - PLATFORM_HEIGHT) and y <= (256 + PLATFORM_HEIGHT):
            return True
    if z == 1:
        if x >= (256 - PLATFORM_WIDTH - 1) and x <= (256 + PLATFORM_WIDTH + 1) \
           and y >= (256 - PLATFORM_HEIGHT - 1) and y <= (256 + PLATFORM_HEIGHT + 1):
            return True
    return False

def apply_script(protocol, connection, config):
    allowed_intel_hold_time = config.get('allowed_intel_hold_time', 300)
    class BabelProtocol(protocol):
#        game_mode = CTF_MODE
        babel = False
        def on_map_change(self, map):
            extensions = self.map_info.extensions
            if ALWAYS_ENABLED:
                self.babel = True
            else:
                if extensions.has_key('babel'):
                    self.babel = extensions['babel']
                else:
                    self.babel = False
            if self.babel:
                self.map_info.cap_limit = 1
                self.map_info.get_entity_location = get_entity_location
                self.map_info.get_spawn_location = get_spawn_location
                for x in xrange(256 - PLATFORM_WIDTH, 256 + PLATFORM_WIDTH):
                    for y in xrange(256 - PLATFORM_HEIGHT, 256 + PLATFORM_HEIGHT):
                        map.set_point(x, y, 1, PLATFORM_COLOR)
            return protocol.on_map_change(self, map)
        
        def is_indestructable(self, x, y, z):
            if self.babel:
                if coord_on_platform(x, y, z):
                    protocol.is_indestructable(self, x, y, z)
                    return True
            return protocol.is_indestructable(self, x, y, z)
    
    class BabelConnection(connection):
        def invalid_build_position(self, x, y, z):
            if not self.god and self.protocol.babel:
                if coord_on_platform(x, y, z):
                    connection.on_block_build_attempt(self, x, y, z)
                    return True
            # prevent enemies from building in protected areas
            if self.team is self.protocol.blue_team:
                if self.world_object.position.x >= 301 and self.world_object.position.x <= 384 \
                    and self.world_object.position.y >= 240 and self.world_object.position.y <= 272:
                        self.send_chat('You can\'t build near the enemy\'s tower!')
                        return True
            if self.team is self.protocol.green_team:
                if self.world_object.position.x >= 128 and self.world_object.position.x <= 211 \
                    and self.world_object.position.y >= 240 and self.world_object.position.y <= 272:
                        self.send_chat('You can\'t build near the enemy\'s tower!')
                        return True
            return False

        def on_block_build_attempt(self, x, y, z):
            if self.invalid_build_position(x, y, z):
                return False
            return connection.on_block_build_attempt(self, x, y, z)

        def on_line_build_attempt(self, points):
            for point in points:
                if self.invalid_build_position(*point):
                    return False
            return connection.on_line_build_attempt(self, points)

        # anti team destruction
        def on_block_destroy(self, x, y, z, mode):
            if self.team is self.protocol.blue_team:
                if not (self.admin or self.user_types.moderator or self.user_types.guard or self.user_types.trusted) and self.tool is SPADE_TOOL and self.world_object.position.x >= 128 and \
                    self.world_object.position.x <= 211 and self.world_object.position.y >= 240 and self.world_object.position.y <= 272:
                        self.send_chat('You can\'t destroy your team\'s blocks in this area. Attack the enemy\'s tower!')
                        return False
                if self.world_object.position.x <= 288:
                    if self.tool is WEAPON_TOOL:
                        self.send_chat('You must be closer to the enemy\'s base to shoot blocks!')
                        return False
                    if mode == GRENADE_DESTROY:
                        self.send_chat('You must be closer to the enemy\'s base to grenade blocks!')
                        return False
            if self.team is self.protocol.green_team:
                if not (self.admin or self.user_types.moderator or self.user_types.guard or self.user_types.trusted) and self.tool is SPADE_TOOL and self.world_object.position.x >= 301 and \
                    self.world_object.position.x <= 384 and self.world_object.position.y >= 240 and self.world_object.position.y <= 272:
                        self.send_chat('You can\'t destroy your team\'s blocks in this area. Attack the enemy\'s tower!')
                        return False
                if self.world_object.position.x >= 224:
                    if self.tool is WEAPON_TOOL:
                        self.send_chat('You must be closer to the enemy\'s base to shoot blocks!')
                        return False
                    if mode == GRENADE_DESTROY:
                        self.send_chat('You must be closer to the enemy\'s base to grenade blocks!')
                        return False
            return connection.on_block_destroy(self, x, y, z, mode)

        auto_kill_intel_hog_call = None

        # kill intel carrier if held too long
        def auto_kill_intel_hog(self):
            self.auto_kill_intel_hog_call = None
            self.kill()
            self.protocol.send_chat('God punished %s for holding the intel too long' % (self.name))

        def restore_default_fog_color(self):
            self.protocol.set_fog_color(getattr(self.protocol.map_info.info, 'fog', (128, 232, 255)))

        def on_flag_take(self):
            if self.auto_kill_intel_hog_call is not None:
                self.auto_kill_intel_hog_call.cancel()
                self.auto_kill_intel_hog_call = None
            self.auto_kill_intel_hog_call = reactor.callLater(allowed_intel_hold_time, self.auto_kill_intel_hog)
            # flash team color in sky
            if self.team is self.protocol.blue_team:
                self.protocol.set_fog_color(getattr(self.protocol.map_info.info, 'fog', (0, 0, 255)))
            if self.team is self.protocol.green_team:
                self.protocol.set_fog_color(getattr(self.protocol.map_info.info, 'fog', (0, 255, 0)))
            reactor.callLater(0.25, self.restore_default_fog_color)
            return connection.on_flag_take(self)

        # return intel to platform if dropped
        def on_flag_drop(self):
            if self.auto_kill_intel_hog_call is not None:
                self.auto_kill_intel_hog_call.cancel()
                self.auto_kill_intel_hog_call = None
            if self.world_object.position.z >= 3:
                self.protocol.onectf_reset_flags()
                self.protocol.send_chat('The intel has returned to the heavens')
            self.protocol.set_fog_color(getattr(self.protocol.map_info.info, 'fog', (255, 0, 0)))
            reactor.callLater(0.25, self.restore_default_fog_color)
            return connection.on_flag_drop(self)

        def on_flag_capture(self):
            if self.auto_kill_intel_hog_call is not None:
                self.auto_kill_intel_hog_call.cancel()
                self.auto_kill_intel_hog_call = None
            return connection.on_flag_capture(self)

        def on_reset(self):
            if self.auto_kill_intel_hog_call is not None:
                self.auto_kill_intel_hog_call.cancel()
                self.auto_kill_intel_hog_call = None
            return connection.on_reset(self)
   
    return BabelProtocol, BabelConnection

8 posts Page 1 of 1 First unread post
Return to “Ace of Spades 0.x Discussion”

Who is online

Users browsing this forum: No registered users and 38 guests