… | |
… | |
10 | |
10 | |
11 | =head2 Extension to <thing> attachments |
11 | =head2 Extension to <thing> attachments |
12 | |
12 | |
13 | You can "attach" extensions to global events, to type/subtypes, |
13 | You can "attach" extensions to global events, to type/subtypes, |
14 | to specifix objects, to players and to maps. |
14 | to specifix objects, to players and to maps. |
15 | On top of that a extension can implement new user commands. |
15 | On top of that an extension can implement new user commands. |
16 | |
16 | |
17 | If a extension for example wants to attach itself to all jeweler |
17 | If an extension for example wants to attach itself to all jeweler |
18 | skills it has to attach itself like this: |
18 | skills it has to attach itself like this: |
19 | |
19 | |
20 | cf::attach_to_type cf::SKILL, cf::SK_JEWELER, |
20 | cf::attach_to_type cf::SKILL, cf::SK_JEWELER, |
21 | on_use_skill => sub { |
21 | on_use_skill => sub { |
22 | ... handling code here ... |
22 | ... handling code here ... |
… | |
… | |
37 | in the game, this is mainly for debugging purposes, as it will produce a |
37 | in the game, this is mainly for debugging purposes, as it will produce a |
38 | high load. |
38 | high load. |
39 | |
39 | |
40 | The map attachments work like this: |
40 | The map attachments work like this: |
41 | |
41 | |
42 | If a extension wants to attach itself to the 'trigger' event (this is |
42 | If an extension wants to attach itself to the 'trigger' event (this is |
43 | the event that is generated when a connection is activated (pushed or |
43 | the event that is generated when a connection is activated (pushed or |
44 | released)), it has to do this: |
44 | released)), it has to do this: |
45 | |
45 | |
46 | cf::attach_to_maps |
46 | cf::attach_to_maps |
47 | on_trigger => sub { |
47 | on_trigger => sub { |
… | |
… | |
114 | This way multiple different attachments have a seperate field for storing |
114 | This way multiple different attachments have a seperate field for storing |
115 | their arguments. |
115 | their arguments. |
116 | |
116 | |
117 | =head2 Defining new user commands |
117 | =head2 Defining new user commands |
118 | |
118 | |
119 | If a extension wants to redefine a user command it does it like this: |
119 | If an extension wants to redefine a user command it does it like this: |
120 | |
120 | |
121 | cf::register_command invite => 10, sub { |
121 | cf::register_command invite => 10, sub { |
122 | my ($who, $args) = @_; |
122 | my ($who, $args) = @_; |
123 | ... |
123 | ... |
124 | } |
124 | } |