1
This commit is contained in:
parent
e2d4f8a28e
commit
fb5b05513d
@ -8,6 +8,7 @@
|
||||
#include "skill.h"
|
||||
#include "human.h"
|
||||
#include "collider.h"
|
||||
#include "roomobstacle.h"
|
||||
|
||||
void InternalShot(Creature* c,
|
||||
MetaData::Equip* weapon_meta,
|
||||
@ -1203,3 +1204,40 @@ void Creature::CheckSpecObject()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
RoomObstacle* Creature::SummonObstacle(int id, const a8::Vec2& pos)
|
||||
{
|
||||
RoomObstacle* obstacle = room->CreateObstacle(id, pos.x, pos.y);
|
||||
if (obstacle) {
|
||||
obstacle->master.Attach(this);
|
||||
room->xtimer.AddRepeatTimerAndAttach
|
||||
(
|
||||
SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(obstacle),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
|
||||
obstacle->ActiveTimerFunc();
|
||||
},
|
||||
&obstacle->xtimer_attacher.timer_list_
|
||||
);
|
||||
|
||||
room->xtimer.AddRepeatTimerAndAttach
|
||||
(
|
||||
SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(obstacle),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
|
||||
obstacle->UpdateTimerFunc();
|
||||
},
|
||||
&obstacle->xtimer_attacher.timer_list_
|
||||
);
|
||||
|
||||
} else {
|
||||
abort();
|
||||
}
|
||||
return obstacle;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ namespace MetaData
|
||||
struct xtimer_list;
|
||||
class Skill;
|
||||
class Obstacle;
|
||||
class RoomObstacle;
|
||||
class Creature : public MoveableEntity
|
||||
{
|
||||
public:
|
||||
@ -113,6 +114,7 @@ class Creature : public MoveableEntity
|
||||
virtual void _UpdateMove(int speed) {};
|
||||
|
||||
void CheckSpecObject();
|
||||
RoomObstacle* SummonObstacle(int id, const a8::Vec2& pos);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -1878,43 +1878,6 @@ void Human::WinExp(Human* sender, int exp)
|
||||
}
|
||||
}
|
||||
|
||||
RoomObstacle* Human::SummonObstacle(int id, const a8::Vec2& pos)
|
||||
{
|
||||
RoomObstacle* obstacle = room->CreateObstacle(id, pos.x, pos.y);
|
||||
if (obstacle) {
|
||||
obstacle->master.Attach(this);
|
||||
room->xtimer.AddRepeatTimerAndAttach
|
||||
(
|
||||
SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(obstacle),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
|
||||
obstacle->ActiveTimerFunc();
|
||||
},
|
||||
&obstacle->xtimer_attacher.timer_list_
|
||||
);
|
||||
|
||||
room->xtimer.AddRepeatTimerAndAttach
|
||||
(
|
||||
SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(obstacle),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
RoomObstacle* obstacle = (RoomObstacle*)param.sender.GetUserData();
|
||||
obstacle->UpdateTimerFunc();
|
||||
},
|
||||
&obstacle->xtimer_attacher.timer_list_
|
||||
);
|
||||
|
||||
} else {
|
||||
abort();
|
||||
}
|
||||
return obstacle;
|
||||
}
|
||||
|
||||
void Human::_InternalUpdateMove(float speed)
|
||||
{
|
||||
float nx = move_dir.x * speed;
|
||||
|
@ -238,7 +238,6 @@ class Human : public Creature
|
||||
int GetSeat() { return seat_; }
|
||||
void SetSeat(int seat) { seat_ = seat; }
|
||||
void DeadDrop();
|
||||
RoomObstacle* SummonObstacle(int id, const a8::Vec2& pos);
|
||||
virtual std::string GetName() override { return name;};
|
||||
|
||||
protected:
|
||||
|
Loading…
x
Reference in New Issue
Block a user