1
This commit is contained in:
parent
af9ec9a61f
commit
511044816d
@ -1007,72 +1007,6 @@ void Human::UpdateAction()
|
|||||||
break;
|
break;
|
||||||
case AT_UseItem:
|
case AT_UseItem:
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
switch (action_item_id) {
|
|
||||||
case IS_HEALTHKIT:
|
|
||||||
{
|
|
||||||
MetaData::Equip* item_meta = MetaMgr::Instance()->GetEquipBySlotId(action_item_id);
|
|
||||||
if (item_meta){
|
|
||||||
if (GetInventory(item_meta->i->_inventory_slot()) > 0) {
|
|
||||||
float old_health = health;
|
|
||||||
health += item_meta->i->heal();
|
|
||||||
health = std::min(health, GetMaxHP());
|
|
||||||
stats.heal_amount += health - old_health;
|
|
||||||
DecInventory(item_meta->i->_inventory_slot(), 1);
|
|
||||||
need_sync_active_player = true;
|
|
||||||
SyncAroundPlayers();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case IS_PAIN_KILLER:
|
|
||||||
{
|
|
||||||
MetaData::Equip* item_meta = MetaMgr::Instance()->GetEquipBySlotId(action_item_id);
|
|
||||||
if (item_meta){
|
|
||||||
if (GetInventory(item_meta->i->_inventory_slot()) > 0) {
|
|
||||||
if (pain_killer_timer) {
|
|
||||||
int passed_time = (room->frame_no - pain_killer_frameno) * FRAME_RATE_MS;
|
|
||||||
int left_time = std::max(0, pain_killer_lastingtime * 1000 - passed_time);
|
|
||||||
int anodyne_max_time = MetaMgr::Instance()->GetSysParamAsInt("anodyne_max_time");
|
|
||||||
left_time = std::min(left_time, anodyne_max_time * 1000);
|
|
||||||
pain_killer_lastingtime += std::min(item_meta->i->time() * 1000, anodyne_max_time * 1000 - left_time) / 1000;
|
|
||||||
need_sync_active_player = true;
|
|
||||||
} else {
|
|
||||||
pain_killer_frameno = room->frame_no;
|
|
||||||
pain_killer_lastingtime = item_meta->i->time();
|
|
||||||
pain_killer_timer = room->xtimer.AddRepeatTimerAndAttach(
|
|
||||||
SERVER_FRAME_RATE,
|
|
||||||
a8::XParams()
|
|
||||||
.SetSender(this)
|
|
||||||
.SetParam1(item_meta->i->heal()),
|
|
||||||
[] (const a8::XParams& param)
|
|
||||||
{
|
|
||||||
Human* hum = (Human*)param.sender.GetUserData();
|
|
||||||
float old_health = hum->health;
|
|
||||||
hum->health += param.param1.GetDouble();
|
|
||||||
hum->health = std::min(hum->health, hum->GetMaxHP());
|
|
||||||
hum->stats.heal_amount += hum->health - old_health;
|
|
||||||
hum->SyncAroundPlayers();
|
|
||||||
if (hum->room->frame_no - hum->pain_killer_frameno > hum->pain_killer_lastingtime * SERVER_FRAME_RATE) {
|
|
||||||
hum->room->xtimer.DeleteTimer(hum->pain_killer_timer);
|
|
||||||
hum->pain_killer_timer = nullptr;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
&xtimer_attacher.timer_list_
|
|
||||||
);
|
|
||||||
}
|
|
||||||
DecInventory(item_meta->i->_inventory_slot(), 1);
|
|
||||||
need_sync_active_player = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -86,10 +86,6 @@ class Human : public Entity
|
|||||||
|
|
||||||
PlayerStats stats;
|
PlayerStats stats;
|
||||||
|
|
||||||
int pain_killer_frameno = 0;
|
|
||||||
int pain_killer_lastingtime = 0;
|
|
||||||
xtimer_list* pain_killer_timer = nullptr;
|
|
||||||
|
|
||||||
std::set<Human*>* team_members = nullptr;
|
std::set<Human*>* team_members = nullptr;
|
||||||
std::set<Human*> kill_humans;
|
std::set<Human*> kill_humans;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user