Jump to content

terra_magna warning messages appeared!


gameboy
 Share

Recommended Posts

@stanislas69 Today, I tested the latest https://github.com/0ADMods/terra_magna and warnings in combat:

WARNING: JavaScript warning: simulation/components/Player.js line 380 reference to undefined property this.resourceCount[type]

WARNING: JavaScript warning: simulation/components/StatisticsTracker.js line 428 reference to undefined property this.resourcesUsed[type]

WARNING: JavaScript warning: simulation/ai/petra/diplomacyManager.js line 83 reference to undefined property availableResources[res]

 

Edited by gameboy
Link to comment
Share on other sites

Moved the topic, hopefully to the right subforum.

I don't see any template in TM that uses a custom resource.

@gameboy can you upload the replay?

Perhaps a second mod was enabled?

I would have guessed gamesetup keeping some information somewhere (e.g. custom StartingResources), but we changed it to not load data of different mods.

  • Like 1
Link to comment
Share on other sites

On 5/11/2018 at 12:14 PM, gameboy said:

WARNING: JavaScript warning: simulation/components/Player.js line 380 reference to undefined property this.resourceCount[type]

WARNING: JavaScript warning: simulation/components/StatisticsTracker.js line 428 reference to undefined property this.resourcesUsed[type]

WARNING: JavaScript warning: simulation/ai/petra/diplomacyManager.js line 83 reference to undefined property availableResources[res]

This is likely cause by the Xiongnu not having a civ center at some point.

Link to comment
Share on other sites

@elexis Couldn't find a way to reproduce it. 

The only similar warnings I managed to get was by playing in atlas  switching the civ in atlas and then playing again.

But I guess that's an edge case. 

I tried to play Xiongnu against IA (Chinese)and nothing happened maybe trying the converse.

Link to comment
Share on other sites

@elexis my friend, please help me!

Today, I tested the latest https://github.com/0ADMods/terra_magna, The same warning appears again: 

WARNING: JavaScript warning: simulation/components/Player.js line 380 reference to undefined property this.resourceCount[type]

WARNING: JavaScript warning: simulation/components/StatisticsTracker.js line 428 reference to undefined property this.resourcesUsed[type]

WARNING: JavaScript warning: simulation/ai/petra/diplomacyManager.js line 83 reference to undefined property availableResources[res]

 

 

commands.txt

Link to comment
Share on other sites

While waiting for a clean git compile to build, I reproduced the originally posted error with the latest replay.

Don't have to be a well versed developer to just get more information from the error:

Index: binaries/data/mods/public/simulation/components/Player.js
===================================================================
--- binaries/data/mods/public/simulation/components/Player.js	(revision 21819)
+++ binaries/data/mods/public/simulation/components/Player.js	(working copy)
@@ -377,7 +377,15 @@
 	}
 
 	for (var type in amounts)
+	{
+		if (!this.resourceCount[type])
+		{
+			warn("broken: " + uneval(type))
+			warn(new Error().stack);
+		}
+
 		this.resourceCount[type] -= amounts[type];
+	}
 
 	return true;
 };

This yields

Turn 3324 (200)...
WARNING: broken: "glory"
WARNING: Player.prototype.SubtractResourcesOrNotify@simulation/components/Player.js:384:9
Player.prototype.TrySubtractResources@simulation/components/Player.js:395:7
ProductionQueue.prototype.AddBatch@simulation/components/ProductionQueue.js:352:9
g_Commands.research@simulation/helpers/Commands.js:370:4
ProcessCommand@simulation/helpers/Commands.js:47:3

From the first line we see something contains a "glory" resource (which doesn't exist in both mods).

From the last two lines we see it occurs when processing a research command on turn 3324.

In the replay there is only one research command on that turn. But commands are processed two turns later as I recall, so its likely the first one:

cmd 1 {"type":"research","entity":4847,"template":"attack_soldiers_will"}
end
turn 3323 200
end
turn 3324 200
cmd 1 {"type":"research","entity":4847,"template":"chinese/art_of_war"}

Searching for glory in terra_magna/simulation yields an occurrence in about every chinese tech.

So this means either glory is a new addition or it got removed unintendedly recently.

Doing a git log yields:

commit 022f463eb34ff6e5cac36cee39df96223c095edd
Author: Niek ten Brinke <niektb95@gmail.com>
Date:   Sat Aug 12 12:16:09 2017 +0200

    Implement some of Delenda Est's changes to the Chinese

@niektb you either want to remove the glory costs or add the glory resource

</case>

  • Like 2
Link to comment
Share on other sites

  • s0600204 changed the title to Terra_magna has some warnings in the battle

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...