1 /* src/server/map_object_actions.h
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.
8 #ifndef MAP_OBJECT_ACTIONS_H
9 #define MAP_OBJECT_ACTIONS_H
11 #include <stdint.h> /* uint8_t */
18 uint8_t id; /* identifies action in MapObj.command; therefore must be >0 */
19 struct MapObjAct * next;
20 void (* func) (struct MapObj *); /* function called after .effort turns */
21 char * name; /* human-readable identifier */
22 uint8_t effort; /* how many turns the action takes */
27 /* Free MapObjAct * chain starting at "moa". */
28 extern void free_map_object_actions(struct MapObjAct * moa);
30 /* Return world.map_obj_acts MapObjAct.id for "name". */
31 extern uint8_t get_moa_id_by_name(char * name);
33 /* Actor "mo" does nothing. */
34 extern void actor_wait(struct MapObj * mo);
36 /* Actor "mo" tries to move one step in direction described by char mo->arg
37 * (where noth-east is 'e', east 'd' etc.) Move either succeeds, or another
38 * actor is encountered and hit (which leads ot its lifepoint decreasing by one
39 * and eventually death), or the move fails due to an impassable target square.
40 * On success, update object's field of view map.
42 extern void actor_move(struct MapObj * mo);
44 /* Actor "mo" tries to drop from inventory object indexed by number mo->args. */
45 extern void actor_drop(struct MapObj * mo);
47 /* Actor "mo" tries to pick up topmost object from ground into its inventory. */
48 extern void actor_pick(struct MapObj * mo);
50 /* Actor "mo" tries to use inventory object indexed by number mo->args.
51 * (Currently the only valid use is consuming items defined as consumable.)
53 extern void actor_use(struct MapObj * mo);