1
This commit is contained in:
parent
2c243936dd
commit
c91d2ea249
@ -32,6 +32,7 @@
|
|||||||
#include "team.h"
|
#include "team.h"
|
||||||
#include "bornpoint.h"
|
#include "bornpoint.h"
|
||||||
#include "compose.h"
|
#include "compose.h"
|
||||||
|
#include "player.h"
|
||||||
|
|
||||||
#include "mt/Param.h"
|
#include "mt/Param.h"
|
||||||
#include "mt/Hero.h"
|
#include "mt/Hero.h"
|
||||||
@ -3790,8 +3791,68 @@ void Creature::CheckShotHold()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Creature::Throw(int throw_uniid, int slot,
|
void Creature::Throw(int throw_uniid, int slot,
|
||||||
const glm::vec3& pos, const glm::vec3& dir,
|
const glm::vec3& bomb_pos, const glm::vec3& bomb_dir,
|
||||||
float fly_distance, int estimated_time)
|
float fly_distance, int estimated_time)
|
||||||
{
|
{
|
||||||
|
if (slot < 0 || slot >= weapons.size()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Weapon& weapon = weapons.at(slot);
|
||||||
|
if (weapon.weapon_idx != 0 &&
|
||||||
|
weapon.meta &&
|
||||||
|
weapon.ammo > 0) {
|
||||||
|
if (HasBuffEffect(kBET_Hide)) {
|
||||||
|
RemoveHideEffect(kShotReason);
|
||||||
|
}
|
||||||
|
if (!nature_recover_hp_idle_timer.expired()) {
|
||||||
|
room->xtimer.FireEvent
|
||||||
|
(
|
||||||
|
nature_recover_hp_idle_timer,
|
||||||
|
kRemoveNatureRecoverTimerEvent,
|
||||||
|
nullptr);
|
||||||
|
}
|
||||||
|
--weapon.ammo;
|
||||||
|
room->frame_event.AddPropChgEx
|
||||||
|
(
|
||||||
|
GetWeakPtrRef(),
|
||||||
|
kPropWeaponAmmo,
|
||||||
|
weapon.weapon_idx,
|
||||||
|
weapon.ammo,
|
||||||
|
weapon.GetClipVolume(this),
|
||||||
|
0,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
DecInventory(weapon.meta->_inventory_slot(), 1);
|
||||||
|
if (IsHuman()) {
|
||||||
|
AsHuman()->SyncVolume(weapon.meta->_inventory_slot());
|
||||||
|
}
|
||||||
|
SetAttackDir(bomb_dir);
|
||||||
|
int throw_uniid = room->AllocUniid();
|
||||||
|
room->frame_event.AddBullet
|
||||||
|
(
|
||||||
|
throw_uniid,
|
||||||
|
GetWeakPtrRef(),
|
||||||
|
weapon.meta,
|
||||||
|
1,
|
||||||
|
bomb_pos,
|
||||||
|
bomb_dir,
|
||||||
|
fly_distance,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
nullptr);
|
||||||
|
//pending_throw_bomb[throw_uniid] = throw_bomb;
|
||||||
|
room->xtimer.SetTimeoutEx
|
||||||
|
(
|
||||||
|
SERVER_FRAME_RATE * 15,
|
||||||
|
[this, throw_uniid] (int event, const a8::Args* args)
|
||||||
|
{
|
||||||
|
if (a8::TIMER_DELETE_EVENT == event) {
|
||||||
|
if (IsPlayer()) {
|
||||||
|
AsPlayer()->ProcThrowDmg(throw_uniid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
&room->xtimer_attacher_);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user