From 1f36f13ceafab93f28d0b2629d0e9804435969a6 Mon Sep 17 00:00:00 2001 From: Andy Belle-Isle Date: Sat, 7 Sep 2019 01:11:57 -0400 Subject: Added new physics component that allows entities to fall --- src/components/Physics.hpp | 41 +++++++++++++++++++++++++++++++++++++++++ src/components/Player.hpp | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/components/Physics.hpp (limited to 'src/components') diff --git a/src/components/Physics.hpp b/src/components/Physics.hpp new file mode 100644 index 0000000..378e87f --- /dev/null +++ b/src/components/Physics.hpp @@ -0,0 +1,41 @@ +/** + * @file Physics.hpp + * Copyright (C) 2019 Belle-Isle, Andrew + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef COMPONENT_PHYSICS_HPP_ +#define COMPONENT_PHYSICS_HPP_ + +#include "Component.hpp" + +struct Physics : Component +{ +public: + bool standing = true; + Physics FromLua([[maybe_unused]] sol::object ref) + { + return *this; + } + + void serialize([[maybe_unused]] cereal::JSONOutputArchive& ar) final {} + void serialize([[maybe_unused]] cereal::JSONInputArchive& ar) final {} + + std::string serializeName(void) const final { + return "Physics"; + } +}; + +#endif//COMPONENT_PHYSICS_HPP_ diff --git a/src/components/Player.hpp b/src/components/Player.hpp index 33db1eb..a550c4f 100644 --- a/src/components/Player.hpp +++ b/src/components/Player.hpp @@ -1,5 +1,5 @@ /** - * @file Player.h + * @file Player.hpp * Component for designating player-controlled entities. * * Copyright (C) 2019 Clyne Sullivan -- cgit v1.2.3