1
This commit is contained in:
parent
05ce89b99b
commit
c77bf62645
@ -2743,6 +2743,24 @@ std::weak_ptr<Effect> Creature::AddEffect(int effect_id)
|
||||
return effect;
|
||||
}
|
||||
|
||||
std::weak_ptr<Effect> Creature::AddEffectAndSetTime(int effect_id, int time)
|
||||
{
|
||||
auto p = AddEffect(effect_id);
|
||||
room->xtimer.SetTimeoutEx
|
||||
(
|
||||
time / FRAME_RATE_MS,
|
||||
[this, p] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
if (!p.expired()) {
|
||||
p.lock()->RemoveFromOwner();
|
||||
}
|
||||
}
|
||||
},
|
||||
&xtimer_attacher);
|
||||
return p;
|
||||
}
|
||||
|
||||
void Creature::RemoveEffect(int effect_uniid)
|
||||
{
|
||||
effect_hash_.erase(effect_uniid);
|
||||
|
@ -182,6 +182,7 @@ class Creature : public MoveableEntity
|
||||
Team* GetTeam() { return team_; }
|
||||
void SetTeam(Team* team) { team_ = team; }
|
||||
std::weak_ptr<Effect> AddEffect(int effect_id);
|
||||
std::weak_ptr<Effect> AddEffectAndSetTime(int effect_id, int time);
|
||||
void RemoveEffect(std::weak_ptr<Effect> effect);
|
||||
void RemoveEffect(int effect_uniid);
|
||||
void RemoveEffects(std::vector<int> effect_uniids);
|
||||
|
Loading…
x
Reference in New Issue
Block a user