Map Extensions+ [UPDATED]

Intended for use on live public servers.
7 posts Page 1 of 1 First unread post
Influx
Mapper
Mapper
Posts: 163
Joined: Sat Dec 15, 2012 5:11 pm


Download Map Extensions+
UPDATED: 3rd August 2013

This is just a quick little script I whipped up which adds a couple of new features to the map extensions script that comes with PySnip/PySpades, since I'd noticed a few people asking how to do them. I am aware that there are other ways of achieving the features I've added, but they're now located in one handy script.

The features it adds are;

- Custom spawns
- Block Protection
- 'No Build' Protection
- 'No Destroy' Protection

For the protection zones, admins can still bypass the protection by entering God mode and building/destroying in the protected zone.

To use these features, add the following commands to your map.txt file (as applicable)

'blue_spawn': [(x, y, (z))] - z value is optional, will spawn at the map's ground height if not included
'blue_spawn_offset': (value) - Max offset in any direction from the location provided above. Optional, if not included, defaults to 50.
'green_spawn': same as blue_spawn
'green_spawn_offset': same as blue_spawn_offset
'protected': [ [ (x, y, z), (x, y, z) ] ] - NOTE: 2 square brackets must be used before the very first set of co-ordinates and after the very last set. First set of co-ordinates are one corner of the protection box, the second set are the opposite corner
'nobuild':[ [(x, y, z), (x, y, z)] ] - Same as above - forbids building only
'nodestroy':[ [(x, y, z), (x, y, z)] ] - Same as above - forbids destroying blocks only

Here's an example of a map.txt;
Code: Select all
extensions = {
'blue_spawn': [(0, 0)], #Spawns blues at 0, 0
'blue_spawn_offset': 10, #Blues can spawn a maximum of 10 blocks from 0, 0
'green_spawn':[(512, 0), (512, 512, 20)] #Greens have two spawns which they can randomly spawn at. Second one will force players to spawn at height 20
#No green_spawn_offset. The script will default to 50 blocks in all directions.
'protected': [ [(0, 0, 0), (10, 10, 63)], [(10, 20, 0), (0, 10, 63)] ] #This contains two protected areas; One goes from (0, 0, 0) to (10, 10, 63), and the second one goes from (10, 20, 0) to (0, 10, 63). 
#Note that the values in the second bracket can be lower than the first bracket
'nobuild': [ [250, 250, 0], [260, 260, 63] ]
'nodestroy': [ [280, 250, 0], [220, 250, 0] ]
}
Now I've only done the slightest of testing to confirm it works on localhost. I can't imagine there being anything in there to crash your game, but if there is, let me know and I'll get on it ASAP. Also, if there's any other feature you'd like to see added, let me know and I'll see what I can do!

Other than that, have fun.

UPDATE: Fixed bug Lostmotel pointed out, added new feature requested.
Last edited by Influx on Sat Aug 03, 2013 7:56 pm, edited 1 time in total.
rakiru
Coder
Coder
Posts: 1349
Joined: Sun Nov 11, 2012 12:26 pm


Would it be possible to set the spawn rotation in there, as well as location?
Lostmotel
League Participant
League Participant
Posts: 298
Joined: Sun Nov 18, 2012 1:09 pm


Thank you, Influx. Blue_Happy1
That's exactly what I've been looking for.
Gonna do some testing on it right now.

EDIT: I think I found a bug. The block protection works perfectly fine when I choose a map with the map metadata which has the extension "protected", but after advancing to a map without this extension I am unable to place or destroy blocks and I get the following error:
Spoiler:
2013-04-16 17:13:42+0200 [-] File "C:\Dokumente und Einstellungen\Andy\Desktop\aos\maptestserver\scripts\map_extensions.py", line 126, in on_block_build_attempt
2013-04-16 17:13:42+0200 [-] UnboundLocalError: local variable 'protected' referenced before assignment
Lostmotel
League Participant
League Participant
Posts: 298
Joined: Sun Nov 18, 2012 1:09 pm


bump!
A second map extension which only enables building but no destruction in a certain area would also be nice Blue_Wink1
Influx
Mapper
Mapper
Posts: 163
Joined: Sat Dec 15, 2012 5:11 pm


rakiru wrote:
Would it be possible to set the spawn rotation in there, as well as location?
I've looked into changing the spawn orientation but I just couldn't seem to get it working no matter how hard I tried. It's beyond my comprehension, although someone more talented *cough* thepolm3 *cough* may have a better chance.
Lostmotel wrote:
Thank you, Influx. Blue_Happy1
That's exactly what I've been looking for.
Gonna do some testing on it right now.

EDIT: I think I found a bug. The block protection works perfectly fine when I choose a map with the map metadata which has the extension "protected", but after advancing to a map without this extension I am unable to place or destroy blocks and I get the following error:
Spoiler:
2013-04-16 17:13:42+0200 [-] File "C:\Dokumente und Einstellungen\Andy\Desktop\aos\maptestserver\scripts\map_extensions.py", line 126, in on_block_build_attempt
2013-04-16 17:13:42+0200 [-] UnboundLocalError: local variable 'protected' referenced before assignment
I've fixed that. It was caused by some code that hadn't been properly indented.
Lostmotel wrote:
bump!
A second map extension which only enables building but no destruction in a certain area would also be nice Blue_Wink1
Done, and also implemented destruction but no building.

Also, I've allowed admins to be able to enter God Mode and break things or build things in the protected zones, so block spamming and wanton destruction can be cleared.

(They have to enter God Mode so they don't innocently start building where they shouldn't if they are playing the game normally)
Lostmotel
League Participant
League Participant
Posts: 298
Joined: Sun Nov 18, 2012 1:09 pm


thank you Influx, great work as always Blue_BigSmile
There should be a pysnip update so we can get people to use all these imroved scripts like this one or the new votekick script.
Jdrew
Mapper
Mapper
Posts: 4808
Joined: Tue Oct 30, 2012 10:48 pm


should be included in default pysnip
7 posts Page 1 of 1 First unread post
Return to “Completed Releases”

Who is online

Users browsing this forum: No registered users and 4 guests