2002-08-15 07:05:17 +00:00
|
|
|
#include "math.h"
|
|
|
|
#include "physics.h"
|
|
|
|
#include "qw_message.h"
|
2002-08-14 15:40:30 +00:00
|
|
|
#include "sound.h"
|
2002-08-17 05:27:34 +00:00
|
|
|
|
2002-08-14 15:40:30 +00:00
|
|
|
#include "tempent.h"
|
2002-08-17 05:27:34 +00:00
|
|
|
|
|
|
|
#include "GameEntity.h"
|
|
|
|
#include "World.h"
|
|
|
|
#include "Axe.h"
|
2002-08-14 15:40:30 +00:00
|
|
|
|
|
|
|
@implementation Axe
|
|
|
|
|
2002-08-17 05:27:34 +00:00
|
|
|
- (id) init
|
2002-08-14 15:40:30 +00:00
|
|
|
{
|
|
|
|
[super init];
|
|
|
|
damage = (deathmatch > 3) ? 75.0 : 20.0;
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2002-08-17 05:27:34 +00:00
|
|
|
- (void) setOwner: (Entity) o
|
2002-08-14 15:40:30 +00:00
|
|
|
{
|
|
|
|
owner = o;
|
|
|
|
}
|
|
|
|
|
2002-08-17 05:27:34 +00:00
|
|
|
- (void) fire
|
2002-08-14 15:40:30 +00:00
|
|
|
{
|
2002-08-17 05:27:34 +00:00
|
|
|
local entity s = [owner ent];
|
|
|
|
local vector org, source;
|
2002-08-14 15:40:30 +00:00
|
|
|
|
|
|
|
makevectors (s.v_angle);
|
|
|
|
source = s.origin + '0 0 16';
|
2002-08-17 05:27:34 +00:00
|
|
|
|
2002-08-14 15:40:30 +00:00
|
|
|
traceline (source, source + v_forward * 64, NO, s);
|
|
|
|
if (trace_fraction == 1.0)
|
2002-08-17 05:27:34 +00:00
|
|
|
return;
|
2002-08-14 15:40:30 +00:00
|
|
|
|
|
|
|
org = trace_endpos - v_forward * 4;
|
|
|
|
|
2002-08-17 05:27:34 +00:00
|
|
|
if ([trace_ent.@this takeDamage: self inflictor: s attacker: s : damage])
|
2002-08-14 15:40:30 +00:00
|
|
|
SpawnBlood (org, 20);
|
|
|
|
else {
|
|
|
|
sound (s, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
|
|
|
|
|
2003-03-03 05:28:13 +00:00
|
|
|
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_GUNSHOT, 3.0);
|
|
|
|
WriteCoordV (MSG_MULTICAST, org);
|
2002-08-14 15:40:30 +00:00
|
|
|
multicast (org, MULTICAST_PVS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|