1
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
3
#ifndef GAME_SERVER_ENTITY_CHARACTER_H
4
#define GAME_SERVER_ENTITY_CHARACTER_H
6
#include <game/server/entity.hpp>
7
#include <game/generated/gs_data.hpp>
8
#include <game/generated/g_protocol.hpp>
10
#include <game/gamecore.hpp>
14
WEAPON_GAME = -3, // team switching etc
15
WEAPON_SELF = -2, // console kill command
16
WEAPON_WORLD = -1, // death tiles etc
19
class CHARACTER : public ENTITY
23
// player controlling this character
29
ENTITY *hitobjects[10];
37
} weapons[NUM_WEAPONS];
51
// TODO: clean this up
57
int last_action; // last tick that the player took any action ie some input
59
// these are non-heldback inputs
60
NETOBJ_PLAYER_INPUT latest_previnput;
61
NETOBJ_PLAYER_INPUT latest_input;
64
NETOBJ_PLAYER_INPUT previnput;
65
NETOBJ_PLAYER_INPUT input;
69
int damage_taken_tick;
85
int player_state; // if the client is chatting, accessing a menu or so
87
// the player core for the physics
90
// info for dead reckoning
91
int reckoning_tick; // tick that we are performing dead reckoning from
92
CHARACTER_CORE sendcore; // core that we should send
93
CHARACTER_CORE reckoningcore; // the dead reckoning core
99
virtual void destroy();
103
void set_weapon(int w);
105
void handle_weaponswitch();
106
void do_weaponswitch();
108
int handle_weapons();
111
void on_predicted_input(NETOBJ_PLAYER_INPUT *new_input);
112
void on_direct_input(NETOBJ_PLAYER_INPUT *new_input);
115
void die(int killer, int weapon);
117
bool take_damage(vec2 force, int dmg, int from, int weapon);
120
bool spawn(PLAYER *player, vec2 pos, int team);
121
//bool init_tryspawn(int team);
124
static const int phys_size = 28;
127
virtual void tick_defered();
128
virtual void snap(int snapping_client);
130
bool increase_health(int amount);
131
bool increase_armor(int amount);