363 |
} |
} |
364 |
|
|
365 |
/* |
/* |
366 |
* Actor |
** Actor |
367 |
*/ |
*/ |
368 |
namespace world |
namespace world |
369 |
{ |
{ |
370 |
class Actor : public Object { |
class Actor : public Object { |
371 |
public: |
public: |
|
|
|
372 |
// Actor interface. |
// Actor interface. |
373 |
virtual void think (double /*dtime*/); |
virtual void think (double /*dtime*/); |
374 |
|
|
381 |
virtual bool is_on_floor() { return true; } |
virtual bool is_on_floor() { return true; } |
382 |
|
|
383 |
virtual bool can_drop_items() { return false; } |
virtual bool can_drop_items() { return false; } |
384 |
|
virtual bool has_shield() const { return false; } |
385 |
|
|
386 |
virtual void init(); |
virtual void init(); |
387 |
|
|
388 |
// Accessors. |
// Object interface |
389 |
world::ActorInfo *get_actorinfo() { return &actorinfo; } |
void set_attrib(const string &key, const Value &val); |
|
const px::V2 &get_pos() const { return actorinfo.pos; } |
|
|
const px::V2 &get_vel() const { return actorinfo.vel; } |
|
390 |
|
|
391 |
double get_radius() const { return actorinfo.radius; } |
// Methods |
|
double get_mass() const { return actorinfo.mass; } |
|
|
double get_charge() const { return actorinfo.charge; } |
|
392 |
|
|
393 |
void move(); |
void move(); |
394 |
void warp(const px::V2 &newpos); |
void warp(const px::V2 &newpos); |
395 |
|
|
396 |
void respawn(); |
void respawn(); |
397 |
void set_respawnpos(const V2& p) { |
void set_respawnpos(const V2& p); |
398 |
respawnpos = p; |
void remove_respawnpos(); |
|
use_respawnpos = true; |
|
|
} |
|
|
void remove_respawnpos() { |
|
|
use_respawnpos = false; |
|
|
} |
|
399 |
|
|
400 |
void add_force (const px::V2 &f); |
void add_force (const px::V2 &f); |
401 |
|
|
402 |
void set_attrib(const string &key, const Value &val); |
// Accessors. |
403 |
|
world::ActorInfo *get_actorinfo() { return &actorinfo; } |
404 |
|
const px::V2 &get_pos() const { return actorinfo.pos; } |
405 |
|
const px::V2 &get_vel() const { return actorinfo.vel; } |
406 |
|
|
407 |
|
double get_radius() const { return actorinfo.radius; } |
408 |
|
double get_mass() const { return actorinfo.mass; } |
409 |
|
double get_charge() const { return actorinfo.charge; } |
410 |
|
|
411 |
bool has_spikes() const { return spikes; } |
bool has_spikes() const { return spikes; } |
412 |
void set_spikes(bool has) { spikes = has; } |
void set_spikes(bool has) { spikes = has; } |
413 |
|
|
|
virtual bool has_shield() const { return false; } |
|
414 |
protected: |
protected: |
415 |
Actor(const char *name, const px::V2 &pos); |
Actor(const char *name, const px::V2 &pos); |
416 |
void set_model(const string &mname); |
void set_model(const string &mname); |
463 |
void Register (const string &kind, Stone *obj); |
void Register (const string &kind, Stone *obj); |
464 |
void Register (const string &kind, Actor *obj); |
void Register (const string &kind, Actor *obj); |
465 |
|
|
466 |
/* Shutdown Repository */ |
/* Shutdown object repository */ |
467 |
void Repos_Shutdown(); |
void Repos_Shutdown(); |
468 |
|
|
469 |
Object *GetObjectTemplate(const string &kind); |
Object *GetObjectTemplate(const string &kind); |