Permalink
Browse files

Fix ticket: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.
  • Loading branch information...
1 parent 4af3297 commit 4f030f4b6de8eb6ca9fb422f4b9548ca6127acb8 @perim perim committed Feb 7, 2012
View
@@ -25,6 +25,7 @@ powerOutput = 2000
armourKinetic = 100
armourHeat = 100
designable = false
+droidType = TRANSPORTER
[Superbody]
name = "*Kev's Super Body*"
@@ -67,6 +68,7 @@ powerOutput = 600
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[CyborgRkt1Ground]
name = "*CyborgRocket1Ground*"
@@ -81,6 +83,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[CyborgFlamerGrd]
name = "*Cyborg Flamer*"
@@ -95,6 +98,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[CyborgChain1Ground]
name = "*CyborgChaingun1Ground*"
@@ -109,6 +113,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[CyborgCannonGrd]
name = "*Cyborg Cannon*"
@@ -123,6 +128,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[CybNXRail1Jmp]
name = "*CybNXRail1Jmp*"
@@ -137,6 +143,7 @@ powerOutput = 675
armourKinetic = 18
armourHeat = 15
designable = false
+droidType = CYBORG
[CybNXPulseLasJmp]
name = "*CybNXPulseLasJ*"
@@ -151,6 +158,7 @@ powerOutput = 675
armourKinetic = 18
armourHeat = 15
designable = false
+droidType = CYBORG
[CybNXMissJmp]
name = "*CybNXMissJmp*"
@@ -165,6 +173,7 @@ powerOutput = 675
armourKinetic = 18
armourHeat = 15
designable = false
+droidType = CYBORG
[CybFlamer01CGrd]
name = "*Cyborg Flamer*"
@@ -179,6 +188,7 @@ powerOutput = 600
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[Cyb-Bod-Rail1]
name = "*Cyb-Bod-Rail1*"
@@ -193,6 +203,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[Cyb-Bod-Las1]
name = "*Cyb-Bod-Las1*"
@@ -207,6 +218,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[Cyb-Bod-Atmiss]
name = "*Cyb-Bod-Atmiss*"
@@ -221,6 +233,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[BusBody]
name = "*School Bus Body*"
@@ -499,4 +512,4 @@ powerOutput = 125
armourKinetic = 1
armourHeat = 1
designable = false
-
+droidType = PERSON
@@ -12,7 +12,7 @@ function activateProduction(fac)
// Remind factory to produce
if (structureIdle(fac))
{
- buildDroid(fac, "Trike", "B4body-sml-trike01", "BaBaProp", "", DROID_WEAPON, "bTrikeMG");
+ buildDroid(fac, "Trike", "B4body-sml-trike01", "BaBaProp", null, null, "bTrikeMG");
}
}
@@ -105,12 +105,12 @@ function eventDroidBuilt(droid, fac1)
// We now have switch statements! And we can use the built-in Math library
switch (Math.floor(Math.random() * 10))
{
- case 0: buildDroid(fac1, "Trike", "B4body-sml-trike01", "BaBaProp", "", DROID_WEAPON, "bTrikeMG"); break;
- case 1: buildDroid(fac1, "Buggy", "B3body-sml-buggy01", "BaBaProp", "", DROID_WEAPON, "BuggyMG"); break;
- case 2: buildDroid(fac1, "Jeep", "B2JeepBody", "BaBaProp", "", DROID_WEAPON, "BJeepMG"); break;
- case 3: buildDroid(fac1, "Cannonbus", "BusBody", "BaBaProp", "", DROID_WEAPON, "BusCannon"); break;
- case 4: buildDroid(fac1, "Firebus", "BusBody", "BaBaProp", "", DROID_WEAPON, "BabaFlame"); break;
- default: buildDroid(fac1, "Bloke", "B1BaBaPerson01", "BaBaLegs", "", DROID_PERSON, "BaBaMG"); break;
+ case 0: buildDroid(fac1, "Trike", "B4body-sml-trike01", "BaBaProp", null, null, "bTrikeMG"); break;
+ case 1: buildDroid(fac1, "Buggy", "B3body-sml-buggy01", "BaBaProp", null, null, "BuggyMG"); break;
+ case 2: buildDroid(fac1, "Jeep", "B2JeepBody", "BaBaProp", null, null, "BJeepMG"); break;
+ case 3: buildDroid(fac1, "Cannonbus", "BusBody", "BaBaProp", null, null, "BusCannon"); break;
+ case 4: buildDroid(fac1, "Firebus", "BusBody", "BaBaProp", null, null, "BabaFlame"); break;
+ default: buildDroid(fac1, "Bloke", "B1BaBaPerson01", "BaBaLegs", null, null, "BaBaMG"); break;
}
}
}
@@ -65,7 +65,7 @@ function buildAttacker(struct)
"MG2Mk1", // twin mg
"MG1Mk1", // mg, initial weapon
];
- if (!buildDroid(struct, "Ranged Attacker", bodylist, proplist, "", DROID_WEAPON, weaplist, weaplist))
+ if (!buildDroid(struct, "Ranged Attacker", bodylist, proplist, null, null, weaplist, weaplist))
{
debug("Failed to construct new attacker");
}
@@ -84,7 +84,7 @@ function buildTruck(struct)
"hover01", // hover
"wheeled01", // wheels
];
- if (!buildDroid(struct, "Constructor", bodylist, proplist, "", DROID_CONSTRUCT, "Spade1Mk1"))
+ if (!buildDroid(struct, "Constructor", bodylist, proplist, null, null, "Spade1Mk1"))
{
debug("Failed to construct new truck");
}
@@ -93,11 +93,11 @@ function buildTruck(struct)
function buildCyborg(struct)
{
// Cyborg templates are special -- their bodies, legs and weapons are linked. We should fix this one day...
- if (!buildDroid(struct, "Cyborg Thermite", "Cyb-Bod-Thermite", "CyborgLegs", "", DROID_CYBORG, "Cyb-Wpn-Thermite"))
+ if (!buildDroid(struct, "Cyborg Thermite", "Cyb-Bod-Thermite", "CyborgLegs", null, null, "Cyb-Wpn-Thermite"))
{
- if (!buildDroid(struct, "Cyborg Flamer", "CyborgFlamerGrd", "CyborgLegs", "", DROID_CYBORG, "CyborgFlamer01"))
+ if (!buildDroid(struct, "Cyborg Flamer", "CyborgFlamerGrd", "CyborgLegs", null, null, "CyborgFlamer01"))
{
- if (!buildDroid(struct, "Cyborg MG", "CyborgChain1Ground", "CyborgLegs", "", DROID_CYBORG, "CyborgChaingun"))
+ if (!buildDroid(struct, "Cyborg MG", "CyborgChain1Ground", "CyborgLegs", null, null, "CyborgChaingun"))
{
debug("Failed to construct new cyborg");
}
@@ -119,7 +119,7 @@ function buildVTOL(struct)
"Body4ABT", // bug
"Body1REC", // viper
];
- if (!buildDroid(struct, "Bomber", bodylist, "V-Tol", "", DROID_WEAPON, bomblist))
+ if (!buildDroid(struct, "Bomber", bodylist, "V-Tol", null, null, bomblist))
{
debug("Failed to construct new VTOL");
}
@@ -459,7 +459,7 @@ function eventDroidBuilt(droid, struct)
{
var sensorlist = enumBlips(me);
- if (struct)
+ if (struct && structureIdle(struct))
{
if (struct.stattype == FACTORY)
{
View
@@ -25,6 +25,7 @@ powerOutput = 2000
armourKinetic = 20
armourHeat = 9
designable = false
+droidType = TRANSPORTER
[MP-SuperTransportBody]
name = "Super Transport Body"
@@ -39,6 +40,7 @@ powerOutput = 6100
armourKinetic = 200
armourHeat = 200
designable = false
+droidType = TRANSPORTER
[Superbody]
name = "Kev's Super Body"
@@ -81,6 +83,7 @@ powerOutput = 600
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[CyborgRkt1Ground]
name = "*CyborgRocket1Ground*"
@@ -95,6 +98,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[CyborgFlamerGrd]
name = "*Cyborg Flamer*"
@@ -109,6 +113,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[CyborgChain1Ground]
name = "*CyborgChaingun1Ground*"
@@ -123,6 +128,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[CyborgCannonGrd]
name = "*Cyborg Cannon*"
@@ -137,6 +143,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[CybNXRail1Jmp]
name = "*CybNXRail1Jmp*"
@@ -151,6 +158,7 @@ powerOutput = 675
armourKinetic = 18
armourHeat = 15
designable = false
+droidType = CYBORG
[CybNXPulseLasJmp]
name = "*CybNXPulseLasJ*"
@@ -165,6 +173,7 @@ powerOutput = 675
armourKinetic = 18
armourHeat = 15
designable = false
+droidType = CYBORG
[CybNXMissJmp]
name = "*CybNXMissJmp*"
@@ -179,6 +188,7 @@ powerOutput = 675
armourKinetic = 18
armourHeat = 15
designable = false
+droidType = CYBORG
[CybFlamer01CGrd]
name = "*Cyborg Flamer*"
@@ -193,6 +203,7 @@ powerOutput = 600
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[Cyb-Hvybod-TK]
name = "Super Tank-Killer Cyborg"
@@ -207,6 +218,7 @@ powerOutput = 500
armourKinetic = 15
armourHeat = 8
designable = false
+droidType = CYBORG_SUPER
[Cyb-Hvybod-RailGunner]
name = "Super Rail-Gunner"
@@ -221,6 +233,7 @@ powerOutput = 500
armourKinetic = 15
armourHeat = 8
designable = false
+droidType = CYBORG_SUPER
[Cyb-Hvybod-PulseLsr]
name = "Super Pulse Laser Cyborg"
@@ -235,6 +248,7 @@ powerOutput = 500
armourKinetic = 15
armourHeat = 8
designable = false
+droidType = CYBORG_SUPER
[Cyb-Hvybod-Mcannon]
name = "Super Heavy-Gunner"
@@ -249,6 +263,7 @@ powerOutput = 500
armourKinetic = 15
armourHeat = 8
designable = false
+droidType = CYBORG_SUPER
[Cyb-Hvybod-HPV]
name = "Super HPV Cyborg"
@@ -263,6 +278,7 @@ powerOutput = 500
armourKinetic = 15
armourHeat = 8
designable = false
+droidType = CYBORG_SUPER
[Cyb-Hvybod-Acannon]
name = "Super Auto-Cannon Cyborg"
@@ -277,6 +293,7 @@ powerOutput = 500
armourKinetic = 15
armourHeat = 8
designable = false
+droidType = CYBORG_SUPER
[Cyb-Hvybod-A-T]
name = "Super Scourge Cyborg"
@@ -291,6 +308,7 @@ powerOutput = 500
armourKinetic = 15
armourHeat = 8
designable = false
+droidType = CYBORG_SUPER
[Cyb-Bod-Thermite]
name = "*Thermite Body*"
@@ -305,6 +323,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[Cyb-Bod-Rail1]
name = "*Cyb-Bod-Rail1*"
@@ -319,6 +338,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[Cyb-Bod-Mechanic]
name = "*Cyborg Mechanic*"
@@ -333,6 +353,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG_REPAIR
[Cyb-Bod-Las1]
name = "*Cyb-Bod-Las1*"
@@ -347,6 +368,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[Cyb-Bod-Grenade]
name = "*Grenadier Body*"
@@ -361,6 +383,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[Cyb-Bod-ComEng]
name = "*Combat Engineer*"
@@ -375,6 +398,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG_CONSTRUCT
[Cyb-Bod-Atmiss]
name = "*Cyb-Bod-Atmiss*"
@@ -389,6 +413,7 @@ powerOutput = 500
armourKinetic = 12
armourHeat = 6
designable = false
+droidType = CYBORG
[BusBody]
name = "*School Bus Body*"
@@ -697,4 +722,4 @@ powerOutput = 125
armourKinetic = 1
armourHeat = 1
designable = false
-
+droidType = PERSON
Oops, something went wrong.

0 comments on commit 4f030f4

Please sign in to comment.