mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
introduced 3 special pseudo weapons. game, self and world to make a difference on how you got killed
This commit is contained in:
parent
1d6668583a
commit
123c5b5b99
|
@ -209,7 +209,7 @@ Messages = [
|
|||
NetMessage("sv_killmsg", [
|
||||
NetIntRange("killer", 0, 'MAX_CLIENTS-1'),
|
||||
NetIntRange("victim", 0, 'MAX_CLIENTS-1'),
|
||||
NetIntRange("weapon", -1, 'NUM_WEAPONS-1'),
|
||||
NetIntRange("weapon", -3, 'NUM_WEAPONS-1'),
|
||||
NetIntAny("mode_special"),
|
||||
]),
|
||||
|
||||
|
|
|
@ -550,7 +550,9 @@ void CHARACTER::tick()
|
|||
col_get((int)(pos.x+phys_size/2), (int)(pos.y+phys_size/2))&COLFLAG_DEATH ||
|
||||
col_get((int)(pos.x-phys_size/2), (int)(pos.y-phys_size/2))&COLFLAG_DEATH ||
|
||||
col_get((int)(pos.x-phys_size/2), (int)(pos.y+phys_size/2))&COLFLAG_DEATH)
|
||||
die(player->client_id, -1);
|
||||
{
|
||||
die(player->client_id, WEAPON_WORLD);
|
||||
}
|
||||
|
||||
// handle weapons
|
||||
handle_weapons();
|
||||
|
|
|
@ -9,6 +9,13 @@
|
|||
|
||||
#include <game/gamecore.hpp>
|
||||
|
||||
enum
|
||||
{
|
||||
WEAPON_GAME = -3, // team switching etc
|
||||
WEAPON_SELF = -2, // console kill command
|
||||
WEAPON_WORLD = -1, // death tiles etc
|
||||
};
|
||||
|
||||
class CHARACTER : public ENTITY
|
||||
{
|
||||
MACRO_ALLOC_POOL_ID()
|
||||
|
|
|
@ -14,11 +14,15 @@ int GAMECONTROLLER_TDM::on_character_death(class CHARACTER *victim, class PLAYER
|
|||
{
|
||||
GAMECONTROLLER::on_character_death(victim, killer, weapon);
|
||||
|
||||
|
||||
if(weapon != WEAPON_GAME)
|
||||
{
|
||||
// do team scoring
|
||||
if(killer == victim->player || killer->team == victim->player->team)
|
||||
teamscore[killer->team&1]--; // klant arschel
|
||||
else
|
||||
teamscore[killer->team&1]++; // good shit
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -389,7 +389,7 @@ void mods_message(int msgtype, int client_id)
|
|||
return;
|
||||
|
||||
p->last_kill = time_get();
|
||||
p->kill_character(); //(client_id, -1);
|
||||
p->kill_character(WEAPON_SELF);
|
||||
p->respawn_tick = server_tick()+server_tickspeed()*3;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ void PLAYER::snap(int snapping_client)
|
|||
|
||||
void PLAYER::on_disconnect()
|
||||
{
|
||||
kill_character();
|
||||
kill_character(WEAPON_GAME);
|
||||
|
||||
//game.controller->on_player_death(&game.players[client_id], 0, -1);
|
||||
|
||||
|
@ -126,12 +126,12 @@ CHARACTER *PLAYER::get_character()
|
|||
return 0;
|
||||
}
|
||||
|
||||
void PLAYER::kill_character()
|
||||
void PLAYER::kill_character(int weapon)
|
||||
{
|
||||
//CHARACTER *chr = get_character();
|
||||
if(character)
|
||||
{
|
||||
character->die(client_id, -1);
|
||||
character->die(client_id, weapon);
|
||||
delete character;
|
||||
character = 0;
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ void PLAYER::set_team(int new_team)
|
|||
str_format(buf, sizeof(buf), "%s joined the %s", server_clientname(client_id), game.controller->get_team_name(new_team));
|
||||
game.send_chat(-1, GAMECONTEXT::CHAT_ALL, buf);
|
||||
|
||||
kill_character();
|
||||
kill_character(WEAPON_GAME);
|
||||
team = new_team;
|
||||
score = 0;
|
||||
dbg_msg("game", "team_join player='%d:%s' team=%d", client_id, server_clientname(client_id), team);
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
|
||||
CHARACTER *get_character();
|
||||
|
||||
void kill_character();
|
||||
void kill_character(int weapon);
|
||||
|
||||
void try_respawn();
|
||||
void respawn();
|
||||
|
|
Loading…
Reference in a new issue