forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
avatar_action.h
85 lines (66 loc) · 2.69 KB
/
avatar_action.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#pragma once
#ifndef CATA_SRC_AVATAR_ACTION_H
#define CATA_SRC_AVATAR_ACTION_H
#include <iosfwd>
#include <vector>
#include "activity_type.h"
#include "optional.h"
#include "point.h"
#include "units_fwd.h"
class Character;
class avatar;
class item;
class item_location;
class map;
class turret_data;
namespace avatar_action
{
/** Eat food or fuel 'E' (or 'a') */
void eat( avatar &you, const item_location &loc, bool refuel = false );
void eat( avatar &you, const item_location &loc,
const std::vector<int> &consume_menu_selections,
const std::vector<item_location> &consume_menu_selected_items,
const std::string &consume_menu_filter, activity_id type, bool refuel = false );
// special rules for eating: grazing etc
// returns false if no rules are needed
bool eat_here( avatar &you );
// Standard movement; handles attacks, traps, &c. Returns false if auto move
// should be canceled
bool move( avatar &you, map &m, const tripoint &d );
inline bool move( avatar &you, map &m, const point &d )
{
return move( you, m, tripoint( d, 0 ) );
}
// Handle moving from a ramp
bool ramp_move( avatar &you, map &m, const tripoint &dest );
/** Handles swimming by the player. Called by avatar_action::move(). */
void swim( map &m, avatar &you, const tripoint &p );
void autoattack( avatar &you, map &m );
void mend( avatar &you, item_location loc );
/**
* Checks if the weapon is valid and if the player meets certain conditions for firing it.
* Used for validating ACT_AIM and turret weapon
* @return True if all conditions are true, otherwise false.
*/
bool can_fire_weapon( avatar &you, const map &m, const item &weapon );
/** Checks if the wielded weapon is a gun and can be fired then starts interactive aiming */
void fire_wielded_weapon( avatar &you );
/** Stores fake gun specified by the mutation and starts interactive aiming */
void fire_ranged_mutation( Character &you, const item &fake_gun );
/** Stores fake gun specified by the bionic and starts interactive aiming */
void fire_ranged_bionic( avatar &you, const item &fake_gun, const units::energy &cost_per_shot );
/**
* Checks if the player can manually (with their 2 hands, not via vehicle controls)
* fire a turret and then starts interactive aiming.
* Assumes that the turret is on player position.
*/
void fire_turret_manual( avatar &you, map &m, turret_data &turret );
// Throw an item 't'
void plthrow( avatar &you, item_location loc,
const cata::optional<tripoint> &blind_throw_from_pos = cata::nullopt );
void unload( avatar &you );
// Use item; also tries E,R,W 'a'
void use_item( avatar &you, item_location &loc );
void use_item( avatar &you );
} // namespace avatar_action
#endif // CATA_SRC_AVATAR_ACTION_H