scripttrigger.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // SuperTux
  2. // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. #ifndef HEADER_SUPERTUX_TRIGGER_SCRIPTTRIGGER_HPP
  17. #define HEADER_SUPERTUX_TRIGGER_SCRIPTTRIGGER_HPP
  18. #include "trigger/trigger_base.hpp"
  19. class ScriptTrigger final : public Trigger
  20. {
  21. public:
  22. ScriptTrigger(const ReaderMapping& reader);
  23. static std::string class_name() { return "scripttrigger"; }
  24. virtual std::string get_class_name() const override { return class_name(); }
  25. static std::string display_name() { return _("Script Trigger"); }
  26. virtual std::string get_display_name() const override { return display_name(); }
  27. virtual bool has_variable_size() const override { return true; }
  28. virtual ObjectSettings get_settings() override;
  29. virtual void event(Player& player, EventType type) override;
  30. virtual void draw(DrawingContext& context) override;
  31. private:
  32. EventType triggerevent;
  33. std::string script;
  34. bool must_activate;
  35. bool oneshot;
  36. int runcount;
  37. };
  38. #endif
  39. /* EOF */