Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Load map spawns by lua #4527

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ArturKnopik
Copy link
Contributor

@ArturKnopik ArturKnopik commented Sep 2, 2023

Pull Request Prelude

  • I have followed [proper The Forgotten Server code styling][code].
  • I have read and understood the [contribution guidelines][cont] before making this PR.
  • I am aware that this PR may be closed if the above-mentioned criteria are not fulfilled.

Changes Proposed

Addd possibility to load spawns by calling Game.loadMap()

example script:

local testItem = Action()

function testItem.onUse(player, item, fromPosition, target, toPosition, isHotkey)
	Game.loadMap("data/world/forgotten.otbm")
end

testItem:id(2280)
testItem:register()

Fixes #1209

src/spawn.cpp Dismissed
@@ -22,12 +22,8 @@
static constexpr int32_t MINSPAWN_INTERVAL = 10 * 1000; // 10 seconds to match RME
static constexpr int32_t MAXSPAWN_INTERVAL = 24 * 60 * 60 * 1000; // 1 day

bool Spawns::loadFromXml(const std::string& filename)
bool Spawns::loadFromXml(const std::string& filename, bool isCalledByLua)

Check warning

Code scanning / CodeQL

Poorly documented large function Warning

Poorly documented function: fewer than 2% comments for a function of 174 lines.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DSpeichert delet this

@EPuncker EPuncker requested review from a team September 2, 2023 02:28
@ArturKnopik
Copy link
Contributor Author

issue: #1209

ranisalt
ranisalt previously approved these changes Sep 4, 2023
EPuncker
EPuncker previously approved these changes Sep 4, 2023
src/spawn.h Outdated
@@ -67,7 +67,7 @@ class Spawns
public:
static bool isInZone(const Position& centerPos, int32_t radius, const Position& pos);

bool loadFromXml(const std::string& filename);
bool loadFromXml(const std::string& filename, bool isLuaLoad = false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool loadFromXml(const std::string& filename, bool isLuaLoad = false);
bool loadFromXml(const std::string& filename, bool isCalledByLua = false);

@ArturKnopik ArturKnopik dismissed stale reviews from EPuncker and ranisalt via 14d57a8 September 12, 2023 17:34
@EPuncker EPuncker requested review from ranisalt, marmichalski, DSpeichert and MillhioreBT and removed request for marmichalski September 12, 2023 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Game.loadMap - load spawns
4 participants