| 1 |
import Crossfire |
| 2 |
|
| 3 |
world_prefix = '/world/world_' |
| 4 |
world_len = len( world_prefix ) + len( 'xxx_xxx' ) |
| 5 |
world_sep = '_' |
| 6 |
world_map_size = 50 |
| 7 |
|
| 8 |
Crossfire.SetReturnValue( 1 ) |
| 9 |
|
| 10 |
player = Crossfire.WhoIsActivator() |
| 11 |
gps = Crossfire.WhoAmI() |
| 12 |
map = player.Map |
| 13 |
|
| 14 |
if ( map == 0 ): |
| 15 |
player.Write( 'You\'re lost in a vacuum!') |
| 16 |
else: |
| 17 |
path = map.Path |
| 18 |
if ( path.find( world_prefix ) != 0 ) or ( len( path ) != world_len ): |
| 19 |
player.Write( 'You can\'t position yourself here.' ) |
| 20 |
else: |
| 21 |
marked = player.MarkedItem |
| 22 |
|
| 23 |
if ( marked != gps ) and ( gps.Food == 0 ): |
| 24 |
player.Write( 'You must fix the origin of the positioning system first!' ) |
| 25 |
else: |
| 26 |
coord = path.split( world_sep ) |
| 27 |
if ( len( coord ) != 3 ): |
| 28 |
player.Write( 'Strange place, you can\'t position yourself...' ) |
| 29 |
else: |
| 30 |
map_x = int( coord[ 1 ] ) - 99 |
| 31 |
map_y = int( coord[ 2 ] ) - 99 |
| 32 |
x = map_x * world_map_size + player.X |
| 33 |
y = map_y * world_map_size + player.Y |
| 34 |
|
| 35 |
if ( marked == gps ): |
| 36 |
gps.HP=x |
| 37 |
gps.SP=y |
| 38 |
gps.Food=1 |
| 39 |
player.Write( 'You reset the origin of the system.' ) |
| 40 |
else: |
| 41 |
x = x - gps.HP |
| 42 |
y = y - gps.SP |
| 43 |
player.Write( 'You are at %s:%s.'%( x, y )) |