]> icculus.org git repositories - divverent/nexuiz.git/blob - scmenu/source/custom/player.qm
Adding my current version of the scmenu to the nexuiz cvs.
[divverent/nexuiz.git] / scmenu / source / custom / player.qm
1 // Property of Alientrap/AK
2 // custom/player/player.qm
3
4 // uses target and _target
5 // requires neighbors: Picture, Name, Description
6 void() Nex_Automation_UpdateAvatar_Update =
7 {
8         local entity lItem;
9         local entity lTarget;
10
11         if( self._target.name != "Data::Player::Avatar" )
12                 self._target = Menu_GetItem( "Data::Player::Avatar" );
13
14         lTarget = self._target;
15
16         lItem = Menu_GetItem( "Picture" );
17         String_EntitySet( lItem, picture, lTarget._link.picture );
18
19         lItem = Menu_GetItem( "Name" );
20         String_EntitySet( lItem, text, lTarget._link.normal );
21
22         lItem = Menu_GetItem( "Description" );
23         String_EntitySet( lItem, text, lTarget._link.text );
24 };
25
26 void() Nex_Automation_UpdateAvatar_Destroy =
27 {
28         String_EntityFree( self, target );
29 };
30
31 void() Nex_Automation_UpdateAvatar =
32 {
33         String_EntityZone( self, target );
34
35         self._update = Nex_Automation_UpdateAvatar_Update;
36         self._destroy = Nex_Automation_UpdateAvatar_Destroy;
37 };
38
39 // more concrete functions
40 void() Nex_Action_Avatar_Next =
41 {
42         local entity lItem;
43
44         lItem = Menu_GetItem( "Data::Player::Avatar" );
45         lItem._realValue = lItem._realValue + 1;
46         Raise_DataEvent( lItem, ITEM_DATA_SEND );
47 };
48
49 void() Nex_Action_Avatar_Prev =
50 {
51         local entity lItem;
52
53         lItem = Menu_GetItem( "Data::Player::Avatar" );
54         lItem._realValue = lItem._realValue - 1;
55         Raise_DataEvent( lItem, ITEM_DATA_SEND );
56 };