Validating a custom game type map
Posted: 25 May 2013, 19:24
Hey everyone,
I am trying to get the following custom map code to validate. As of now all it should check is if there is one spawn labelled 'Spawn' with order '0'. Whatever I try the editor keeps telling me 'map cannot be validated' as if somehow the script is faulty. Note that even though anchors shouldn't be editable (option set in main method) they are, leading me to believe something in my script is wrong indeed.
It appears really straightforward from the examples but yet I can't get it to work. Any help would be appreciated.
I am trying to get the following custom map code to validate. As of now all it should check is if there is one spawn labelled 'Spawn' with order '0'. Whatever I try the editor keeps telling me 'map cannot be validated' as if somehow the script is faulty. Note that even though anchors shouldn't be editable (option set in main method) they are, leading me to believe something in my script is wrong indeed.
Code: Select all
#RequireContext CSmMapType
#Include "Libs/Nadeo/Anchor.Script.txt" as Anchor
#Const Version "2013-05-25
#Include "TextLib" as TL
// Initialize the anchors
Void InitAnchors() {
foreach (Data in AnchorData) {
Data.Tag = Data.DefaultTag;
if (Data.DefaultTag == "Spawn") {
Data.Order = Data.DefaultOrder;
}
}
}
// Check map validity
Void UpdateValidability() {
InitAnchors();
Anchor::UpdateAnchorCounts();
if (!Anchor::HasAtLeastOneAnchor("Spawn", 0, TL::Compose(_("Place at least one spawn."))) {
return;
}
ValidationStatus = CMapType::ValidationStatus::Validated;
}
main() {
InitAnchors();
UpdateValidability();
CustomEditAnchorData = False;
while (True) {
yield;
ManialinkText = "";
foreach (Event in PendingEvents) {
if (Events.Type == CPluginEvent::Type::MapModified) {
UpdateValidability();
}
}
}
}