home · contact · privacy
eec0087672a0eb90136b26bb78bd951677de4925
[plomrogue] / src / server / map_object_actions.h
1 /* src/server/map_object_actions.h
2  *
3  * Actions that can be performed my map objects / "actors". Note that apart
4  * from the consequences described below, each action may also trigger log
5  * messages and other minor stuff if the actor is equal to the player.
6  */
7
8 #ifndef MAP_OBJECT_ACTIONS_H
9 #define MAP_OBJECT_ACTIONS_H
10
11 #include <stdint.h> /* uint8_t */
12 struct MapObj;
13
14
15
16 struct MapObjAct
17 {
18     struct MapObjAct * next;
19     void (* func) (struct MapObj *); /* function called after .effort turns */
20     char * name; /* human-readable identifier */
21     uint8_t id; /* unique id of map object action; must be >0 */
22     uint8_t effort; /* how many turns the action takes */
23 };
24
25
26
27 /* Init MapObjAct chain at world.map_obj_acts. */
28 extern void init_map_object_actions();
29
30 /* Free MapObjAct * chain starting at "moa". */
31 extern void free_map_object_actions(struct MapObjAct * moa);
32
33 /* Return world.map_obj_acts MapObjAct.id for "name". */
34 extern uint8_t get_moa_id_by_name(char * name);
35
36 /* Actor "mo" does nothing. */
37 extern void actor_wait(struct MapObj * mo);
38
39 /* Actor "mo" tries to move one step in direction described by char mo->arg
40  * (where east is '6', north '8') etc. Move either succeeds, or another actor is
41  * encountered and hit (which leads ot its lifepoint decreasing by one and
42  * eventually death), or the move fails due to an impassable target square.
43  */
44 extern void actor_move(struct MapObj * mo);
45
46 /* Actor "mo" tries to drop from inventory object indexed by number mo->args. */
47 extern void actor_drop(struct MapObj * mo);
48
49 /* Actor "mo" tries to pick up topmost object from ground into its inventory. */
50 extern void actor_pick(struct MapObj * mo);
51
52 /* Actor "mo" tries to use inventory object indexed by number mo->args.
53  * (Currently the only valid use is consuming an item named "MAGIC MEAT",
54  * which increments the actors lifepoints.)
55  */
56 extern void actor_use(struct MapObj * mo);
57
58
59
60 #endif