Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

Unable to order cyborg engineer production via JS api #3133

Closed
wzdev-ci opened this issue Feb 6, 2012 · 7 comments
Closed

Unable to order cyborg engineer production via JS api #3133

wzdev-ci opened this issue Feb 6, 2012 · 7 comments

Comments

@wzdev-ci
Copy link
Contributor

wzdev-ci commented Feb 6, 2012

resolution_fixed type_bug | by NoQ


The following code

var factories = enumStruct(me, borgfac);
for (var i=0; i<factories.length; ++i) {
	var struct=factories[i];
	if (structureIdle(struct)) {
		return buildDroid(struct, "Truck", "Cyb-Bod-ComEng", "CyborgLegs", "", DROID_CONSTRUCT, "CyborgSpade");
	}
}

doesn't work and produces the following error messages:

error   |03:26:12: [js_buildDroid] Invalid template Truck for factory A0CyborgFactory
error   |03:26:12: [callFunction] 0 : <anonymous>()@multiplay/skirmish/nullbot-mr-0-8.js:841
info    |03:26:12: [callFunction] Uncaught exception calling function "produceDroids" at line 841: ReferenceError: validTemplateForFactory(psTemplate, psStruct) failed in js_buildDroid at line 887
info    |03:26:12: [callFunction] Assert in Warzone: qtscript.cpp:108 (false), last script event: 'N/A'

Issue migrated from trac:3133 at 2022-04-16 08:51:55 -0700

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 6, 2012

NoQ uploaded file nullbot-mr-0-8.js (32.4 KiB)

The complete source code of the AI

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 7, 2012

Per commented


The problem is the simplification I made to droid types. A droid engineer isn't really DROID_CYBORG under the hood. So the choice stands between exporting all the droid types mess into the javascript world, or dropping the droid type parameter and figuring it out dynamically. The latter will require some replumbing and an API change, so will only happen for 3.2, but I think it is the right way to do it.

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 7, 2012

Per Inge Mathisen changed status from new to closed

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 7, 2012

Per Inge Mathisen changed resolution from `` to fixed

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Feb 7, 2012

Per Inge Mathisen commented


Fix #3133 - Unable to order cyborg engineer production via JS api.
The problem was that a simplified droidType was passed in as a function
parameter to buildDroid(), and those droid types simplified out could not
be built. Solution chosen was to remove the droidType parameter - it is now
unused. Instead, the body stats can set the droid type, allowing us to know
which droid type we mean when we have specified a body component.

  • Changeset: [/changeset/4f030f4b6de8eb6ca9fb422f4b9548ca6127acb8 4f030f4b6de8eb6ca9fb422f4b9548ca6127acb8]
  • URL: [4]f030f4b6de8eb6ca9fb422f4b9548ca6127acb8

@wzdev-ci wzdev-ci closed this as completed Feb 7, 2012
@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Aug 4, 2012

Per Inge Mathisen commented


Fix #3133 - Unable to order cyborg engineer production via JS api.
The problem was that a simplified droidType was passed in as a function
parameter to buildDroid(), and those droid types simplified out could not
be built. Solution chosen was to remove the droidType parameter - it is now
unused. Instead, the body stats can set the droid type, allowing us to know
which droid type we mean when we have specified a body component.

  • Changeset: [/changeset/4f030f4b6de8eb6ca9fb422f4b9548ca6127acb8 4f030f4b6de8eb6ca9fb422f4b9548ca6127acb8]
  • URL: [4]f030f4b6de8eb6ca9fb422f4b9548ca6127acb8

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Dec 4, 2012

aubergine commented


Will this also fix the issue with creating cyborg mechanics via buildDroid()?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant