Page 1 of 1

[map] TightRope

Posted: Sat Aug 16, 2014 12:48 pm
by learn_more
This is another map that Jojoe_Stinky made to demonstrate the minefield map extension,
this shows a little more complex usage of minefield sections.

TightRope.png
TightRope.png (630.29 KiB) Viewed 2704 times
Map script.
Spoiler:
Code: Select all
name = 'TightRope'
version = '1.0'
author = 'JoJoe'

extensions = {
	'minefields' : [
		{
			'border' : 1,
			'left' : 125,
			'top' : 126,
			'right' : 384,
			'bottom' : 385,
		},
		{
			'area' : (183, 127, 223, 232),	#top left
			'height' : 60
		},
		{
			'area' : (286, 127, 326, 231),	#top right
			'height' : 60
		},
		{
			'area' : (183, 280, 223, 384),	#bottom left
			'height' : 60
		},
		{
			'area' : (286, 280, 326, 384),	#bottom right
			'height' : 60
		}
	]
}

from pyspades.constants import BLUE_FLAG, GREEN_FLAG, BLUE_BASE, GREEN_BASE
SPAWN_SIZE = (26, 226)
GREEN_RECT = (140, 140, 140+SPAWN_SIZE[0], 140+SPAWN_SIZE[1])
BLUE_RECT = (350, 140, 350+SPAWN_SIZE[0], 140+SPAWN_SIZE[1])

def get_entity_location(team, entity_id):
	#left
	if entity_id == BLUE_FLAG:
		return (190, 256, 0)
	elif entity_id == BLUE_BASE:
		return (160, 256, 0)
	elif entity_id == GREEN_FLAG:
		return (318, 256, 0)
	elif entity_id == GREEN_BASE:
		return (351, 256, 0)

def get_spawn_location(self):
	if self.team is self.protocol.blue_team:
		return self.protocol.get_random_location(True, GREEN_RECT)
	elif self.team is self.protocol.green_team:
		return self.protocol.get_random_location(True, BLUE_RECT)
	return self.protocol.get_random_location(True, (0,0,512,512))


minefield_required_version = 1.6	# we need atleast this version of the minefield script!!!
def on_map_change(self, map):
	minefield_ver = getattr(self, 'minefield_version', 0)
	if minefield_ver < minefield_required_version:
		msg = 'WARNING, THIS MAP NEEDS ATLEAST VERSION {0} OF THE MINEFIELD EXTENSION'.format(minefield_required_version)
		self.send_chat( msg, irc = True )
		print msg
		print 'Get it at: https://github.com/learn-more/pysnip/blob/master/scripts/minefield.py'

Re: [map] TightRope

Posted: Thu Aug 21, 2014 9:53 pm
by Lostmotel
sweet map, love the buildings.