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
|
|
|
|
2008-06-24 03:17:31 -07:00
|
|
|
#ifndef _PLAYER_H
|
|
|
|
#define _PLAYER_H
|
|
|
|
|
2012-03-13 15:44:51 -07:00
|
|
|
#include "Ship.h"
|
2014-01-04 03:11:26 -08:00
|
|
|
#include "ShipCockpit.h"
|
2019-02-15 15:05:44 -08:00
|
|
|
|
|
|
|
class PlayerShipController;
|
2008-06-24 03:17:31 -07:00
|
|
|
|
2019-01-02 08:59:07 -08:00
|
|
|
namespace Graphics {
|
|
|
|
class Renderer;
|
|
|
|
}
|
2012-01-19 08:04:23 -08:00
|
|
|
|
2019-01-02 08:59:07 -08:00
|
|
|
class Player : public Ship {
|
2008-06-24 03:17:31 -07:00
|
|
|
public:
|
2008-09-18 07:00:12 -07:00
|
|
|
OBJDEF(Player, Ship, PLAYER);
|
2019-02-02 06:22:59 -08:00
|
|
|
Player() = delete;
|
|
|
|
Player(const Json &jsonObj, Space *space);
|
2016-09-23 13:53:28 -07:00
|
|
|
Player(const ShipType::Id &shipId);
|
2019-02-02 06:22:59 -08:00
|
|
|
|
2016-10-06 15:03:41 -07:00
|
|
|
virtual void SetDockedWith(SpaceStation *, int port) override;
|
2019-06-01 07:29:58 -07:00
|
|
|
virtual bool DoDamage(float kgDamage) override final; // overloaded to add "crush" audio
|
2020-11-11 16:33:04 -08:00
|
|
|
virtual bool OnDamage(Body *attacker, float kgDamage, const CollisionContact &contactData) override;
|
2016-10-06 15:03:41 -07:00
|
|
|
virtual bool SetWheelState(bool down) override; // returns success of state change, NOT state itself
|
2019-01-02 08:59:07 -08:00
|
|
|
virtual Missile *SpawnMissile(ShipType::Id missile_type, int power = -1) override;
|
2016-10-06 15:03:41 -07:00
|
|
|
virtual void SetAlertState(Ship::AlertState as) override;
|
2019-01-02 08:59:07 -08:00
|
|
|
virtual void NotifyRemoved(const Body *const removedBody) override;
|
2011-04-29 04:46:53 -07:00
|
|
|
|
2014-07-14 13:25:08 -07:00
|
|
|
virtual void SetShipType(const ShipType::Id &shipId) override;
|
2014-04-14 13:41:53 -07:00
|
|
|
|
2012-03-18 07:01:07 -07:00
|
|
|
PlayerShipController *GetPlayerController() const;
|
2012-03-17 11:39:30 -07:00
|
|
|
//XXX temporary things to avoid causing too many changes right now
|
|
|
|
Body *GetCombatTarget() const;
|
|
|
|
Body *GetNavTarget() const;
|
|
|
|
Body *GetSetSpeedTarget() const;
|
2019-01-02 08:59:07 -08:00
|
|
|
void SetCombatTarget(Body *const target, bool setSpeedTo = false);
|
2020-02-02 06:06:14 -08:00
|
|
|
void SetNavTarget(Body *const target);
|
2019-01-02 08:59:07 -08:00
|
|
|
void SetSetSpeedTarget(Body *const target);
|
2018-07-12 22:59:43 -07:00
|
|
|
void ChangeSetSpeed(double delta);
|
2012-03-14 07:59:42 -07:00
|
|
|
|
2017-12-17 12:41:14 -08:00
|
|
|
virtual Ship::HyperjumpStatus InitiateHyperjumpTo(const SystemPath &dest, int warmup_time, double duration, const HyperdriveSoundsTable &sounds, LuaRef checks) override;
|
2016-10-06 15:03:41 -07:00
|
|
|
virtual void AbortHyperjump() override;
|
2012-07-18 19:49:52 -07:00
|
|
|
|
2014-01-04 03:11:26 -08:00
|
|
|
// XXX cockpit is here for now because it has a physics component
|
2014-01-04 03:32:41 -08:00
|
|
|
void InitCockpit();
|
2019-01-02 08:59:07 -08:00
|
|
|
ShipCockpit *GetCockpit() const { return m_cockpit.get(); }
|
2013-12-21 08:48:07 -08:00
|
|
|
void OnCockpitActivated();
|
|
|
|
|
2016-10-06 15:03:41 -07:00
|
|
|
virtual void StaticUpdate(const float timeStep) override;
|
2014-04-14 13:41:53 -07:00
|
|
|
sigc::signal<void> onChangeEquipment;
|
2017-04-19 01:58:49 -07:00
|
|
|
virtual vector3d GetManeuverVelocity() const;
|
|
|
|
virtual int GetManeuverTime() const;
|
2017-05-07 06:54:52 -07:00
|
|
|
|
2008-11-20 09:24:05 -08:00
|
|
|
protected:
|
2018-10-11 08:10:23 -07:00
|
|
|
virtual void SaveToJson(Json &jsonObj, Space *space) override;
|
2011-11-08 21:34:22 -08:00
|
|
|
|
2016-10-06 15:03:41 -07:00
|
|
|
virtual void OnEnterSystem() override;
|
|
|
|
virtual void OnEnterHyperspace() override;
|
2011-11-08 21:34:22 -08:00
|
|
|
|
2014-01-04 03:11:26 -08:00
|
|
|
private:
|
|
|
|
std::unique_ptr<ShipCockpit> m_cockpit;
|
2008-06-24 03:17:31 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _PLAYER_H */
|