function handle_weapon_collision()
{
VECTOR* weapon_base;
VECTOR* weapon_tip;
ENTITY* weapon_holder = you;
if(weapon_holder.attacking == 1)
{
you = NULL;
vec_for_vertex(weapon_base.x, my, 12);
vec_for_vertex(weapon_tip.x, my, 1);
result = c_trace(weapon_base.x, weapon_tip.x, IGNORE_ME | IGNORE_PASSABLE | USE_BOX | USE_POLYGON | SCAN_TEXTURE);
if(you != NULL)
{
if(you.object_typ == 1)
{
if(you.blocking == 0)
{
you.health -= my.weapon_damage;
}
else
{
if (abs(ang(my.pan - you.pan)) >= 45)
{
//block
}
else
{
you.health -= my.weapon_damage;
}
}
}
}
}
}
action attach_sword()
{
set(my, PASSABLE);
my.weapon_damage = 50;
proc_mode = PROC_LATE;
while(you.health>0)
{
vec_for_bone(my.x, you, "weapon");
ang_for_bone(my.pan, you, "weapon");
handle_weapon_collision();
wait(1);
}
}