Revision: | 1.1.1.1 (vendor branch) |
Committed: | Sun Feb 5 00:02:09 2006 UTC (18 years, 5 months ago) by root |
Content type: | text/x-python |
Branch: | UPSTREAM, MAIN |
CVS Tags: | post_fixaltar, last_stable, post_fixaltar2, rel-2_82, rel-2_81, rel-2_80, pre_coinconvert, UPSTREAM_2006_03_15, rel-3_0, rel-2_6, rel-2_7, rel-2_4, rel-2_5, rel-2_2, rel-2_0, rel-2_1, rel-2_72, rel-2_73, rel-2_71, rel-2_76, rel-2_77, rel-2_74, rel-2_75, rel-2_54, rel-2_55, rel-2_56, rel-2_79, UPSTREAM_2006_02_01, rel-2_53, pre_material_cfarch_normalize_run, rel-2_32, pre_fixconverter, post_coinconvert, pre_fixaltar2, pre_map_rename, UPSTREAM_2006_02_22, rel-2_90, rel-2_92, rel-2_93, rel-2_78, post_fixconverter, pre_fixaltar, rel-2_61, rel-2_43, rel-2_42, rel-2_41, HEAD |
Changes since 1.1: | +0 -0 lines |
Log Message: | Initial Import |
# | User | Rev | Content |
---|---|---|---|
1 | root | 1.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 )) |