pioneer/src/Player.h

67 lines
2.3 KiB
C
Raw Permalink Normal View History

2020-12-31 07:32:16 -08:00
// Copyright © 2008-2021 Pioneer Developers. See AUTHORS.txt for details
2012-09-15 17:59:15 -07:00
// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
2012-09-12 04:38:30 -07:00
#ifndef _PLAYER_H
#define _PLAYER_H
#include "Ship.h"
#include "ShipCockpit.h"
class PlayerShipController;
namespace Graphics {
class Renderer;
}
2012-01-19 08:04:23 -08:00
class Player : public Ship {
public:
OBJDEF(Player, Ship, PLAYER);
Player() = delete;
Player(const Json &jsonObj, Space *space);
Player(const ShipType::Id &shipId);
virtual void SetDockedWith(SpaceStation *, int port) override;
virtual bool DoDamage(float kgDamage) override final; // overloaded to add "crush" audio
virtual bool OnDamage(Body *attacker, float kgDamage, const CollisionContact &contactData) override;
virtual bool SetWheelState(bool down) override; // returns success of state change, NOT state itself
virtual Missile *SpawnMissile(ShipType::Id missile_type, int power = -1) override;
virtual void SetAlertState(Ship::AlertState as) override;
virtual void NotifyRemoved(const Body *const removedBody) override;
2011-04-29 04:46:53 -07:00
virtual void SetShipType(const ShipType::Id &shipId) override;
2012-03-18 07:01:07 -07:00
PlayerShipController *GetPlayerController() const;
//XXX temporary things to avoid causing too many changes right now
Body *GetCombatTarget() const;
Body *GetNavTarget() const;
Body *GetSetSpeedTarget() const;
void SetCombatTarget(Body *const target, bool setSpeedTo = false);
void SetNavTarget(Body *const target);
void SetSetSpeedTarget(Body *const target);
void ChangeSetSpeed(double delta);
2012-03-14 07:59:42 -07:00
virtual Ship::HyperjumpStatus InitiateHyperjumpTo(const SystemPath &dest, int warmup_time, double duration, const HyperdriveSoundsTable &sounds, LuaRef checks) override;
virtual void AbortHyperjump() override;
// XXX cockpit is here for now because it has a physics component
2014-01-04 03:32:41 -08:00
void InitCockpit();
ShipCockpit *GetCockpit() const { return m_cockpit.get(); }
void OnCockpitActivated();
virtual void StaticUpdate(const float timeStep) override;
sigc::signal<void> onChangeEquipment;
virtual vector3d GetManeuverVelocity() const;
virtual int GetManeuverTime() const;
protected:
virtual void SaveToJson(Json &jsonObj, Space *space) override;
virtual void OnEnterSystem() override;
virtual void OnEnterHyperspace() override;
private:
std::unique_ptr<ShipCockpit> m_cockpit;
};
#endif /* _PLAYER_H */