1
This commit is contained in:
parent
ee3226984a
commit
0daaa3ec3f
@ -787,7 +787,6 @@ void Buff::ProcRemoveDive()
|
|||||||
void Buff::ProcInWater()
|
void Buff::ProcInWater()
|
||||||
{
|
{
|
||||||
if (owner->IsHuman()) {
|
if (owner->IsHuman()) {
|
||||||
owner->AsHuman()->SetOxygen(MetaMgr::Instance()->dive_oxygen_total);
|
|
||||||
owner->AsHuman()->room->frame_event.AddPropChg
|
owner->AsHuman()->room->frame_event.AddPropChg
|
||||||
(owner->AsHuman()->GetWeakPtrRef(),
|
(owner->AsHuman()->GetWeakPtrRef(),
|
||||||
kPropDive,
|
kPropDive,
|
||||||
@ -828,6 +827,28 @@ void Buff::ProcInWater()
|
|||||||
void Buff::ProcRemoveInWater()
|
void Buff::ProcRemoveInWater()
|
||||||
{
|
{
|
||||||
if (owner->IsHuman()) {
|
if (owner->IsHuman()) {
|
||||||
owner->AsHuman()->SetOxygen(0);
|
if (owner->IsPlayer()) {
|
||||||
|
owner->room->xtimer.AddRepeatTimerAndAttach
|
||||||
|
(
|
||||||
|
SERVER_FRAME_RATE,
|
||||||
|
a8::XParams()
|
||||||
|
.SetSender(owner),
|
||||||
|
[] (const a8::XParams& param)
|
||||||
|
{
|
||||||
|
Creature* c = (Creature*)param.sender.GetUserData();
|
||||||
|
if (!c->IsHuman() || c->HasBuffEffect(kBET_InWater) || c->dead) {
|
||||||
|
c->room->xtimer.DeleteTimer(c->room->xtimer.GetRunningTimer());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Human* hum = c->AsHuman();
|
||||||
|
if (hum->GetOxygen() >= MetaMgr::Instance()->dive_oxygen_total) {
|
||||||
|
c->room->xtimer.DeleteTimer(c->room->xtimer.GetRunningTimer());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
hum->AddOxygen(MetaMgr::Instance()->inwater_oxygen_recover);
|
||||||
|
},
|
||||||
|
&owner->xtimer_attacher.timer_list_
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,7 @@ void Human::Initialize()
|
|||||||
}
|
}
|
||||||
SetMaxHP(GetHP());
|
SetMaxHP(GetHP());
|
||||||
SetCurrWeapon(&weapons[0]);
|
SetCurrWeapon(&weapons[0]);
|
||||||
|
SetOxygen(MetaMgr::Instance()->dive_oxygen_total);
|
||||||
}
|
}
|
||||||
|
|
||||||
float Human::GetSpeed()
|
float Human::GetSpeed()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user