1
This commit is contained in:
parent
e2d4f8a28e
commit
fb5b05513d
@ -8,6 +8,7 @@
|
|||||||
#include "skill.h"
|
#include "skill.h"
|
||||||
#include "human.h"
|
#include "human.h"
|
||||||
#include "collider.h"
|
#include "collider.h"
|
||||||
|
#include "roomobstacle.h"
|
||||||
|
|
||||||
void InternalShot(Creature* c,
|
void InternalShot(Creature* c,
|
||||||
MetaData::Equip* weapon_meta,
|
MetaData::Equip* weapon_meta,
|
||||||
@ -1203,3 +1204,40 @@ void Creature::CheckSpecObject()
|
|||||||
}
|
}
|
||||||
#endif
|
#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;
|
struct xtimer_list;
|
||||||
class Skill;
|
class Skill;
|
||||||
class Obstacle;
|
class Obstacle;
|
||||||
|
class RoomObstacle;
|
||||||
class Creature : public MoveableEntity
|
class Creature : public MoveableEntity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -113,6 +114,7 @@ class Creature : public MoveableEntity
|
|||||||
virtual void _UpdateMove(int speed) {};
|
virtual void _UpdateMove(int speed) {};
|
||||||
|
|
||||||
void CheckSpecObject();
|
void CheckSpecObject();
|
||||||
|
RoomObstacle* SummonObstacle(int id, const a8::Vec2& pos);
|
||||||
|
|
||||||
private:
|
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)
|
void Human::_InternalUpdateMove(float speed)
|
||||||
{
|
{
|
||||||
float nx = move_dir.x * speed;
|
float nx = move_dir.x * speed;
|
||||||
|
@ -238,7 +238,6 @@ class Human : public Creature
|
|||||||
int GetSeat() { return seat_; }
|
int GetSeat() { return seat_; }
|
||||||
void SetSeat(int seat) { seat_ = seat; }
|
void SetSeat(int seat) { seat_ = seat; }
|
||||||
void DeadDrop();
|
void DeadDrop();
|
||||||
RoomObstacle* SummonObstacle(int id, const a8::Vec2& pos);
|
|
||||||
virtual std::string GetName() override { return name;};
|
virtual std::string GetName() override { return name;};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user