2002-08-15 07:05:17 +00:00
|
|
|
#include "math.h"
|
|
|
|
#include "physics.h"
|
|
|
|
#include "qw_message.h"
|
2007-05-07 12:17:12 +00:00
|
|
|
#include "sv_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;
|
|
|
|
|
2003-08-22 06:34:09 +00:00
|
|
|
if ([trace_ent.@this takeDamage:self :owner :owner :damage])
|
2002-08-14 15:40:30 +00:00
|
|
|
SpawnBlood (org, 20);
|
|
|
|
else {
|
|
|
|
sound (s, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
|
|
|
|
|
2010-12-16 11:01:49 +00:00
|
|
|
WriteBytes (MSG_MULTICAST,
|
|
|
|
(float) SVC_TEMPENTITY, (float) TE_GUNSHOT, 3.0);
|
2003-03-03 05:28:13 +00:00
|
|
|
WriteCoordV (MSG_MULTICAST, org);
|
2002-08-14 15:40:30 +00:00
|
|
|
multicast (org, MULTICAST_PVS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|