Author Topic: Bug with cores that use AC (& workaround)  (Read 391 times)


  • Map Maker
  • *****
  • Posts: 1042
  • If you know better, disregard this comment.
Bug with cores that use AC (& workaround)
« on: March 05, 2017, 09:47:38 am »
If you have a core requesting AC packets, don't decrease the core's CONST_AMMOAC by any non-integer amount. Say you have a core that can hold 20AC. The moment that AC drops to 19.9999... it will request a new packet. When the packet arrives, if the core has 19 AC or less, it will just add 1 AC, but if it has, let's say 19.5, the core will fill up to 20 and the extra 0.5 will be wasted.

Because CW3 is older than I am on the inside, I don't think this bug is likely to be patched, so if you really must use fractional amounts of AC, do so abstractly, similar to this:

Code: [Select]
<-WorkingOre <-OrePerTick lt if
  Self CONST_AMMOAC GetUnitAttribute ->ac
  <-ac if
    <-WorkingOre 1.0 add ->WorkingOre
    Self CONST_AMMOAC <-ac 1 sub SetUnitAttribute
<-WorkingOre <-OrePerTick gte if
  <-WorkingOre <-OrePerTick sub ->WorkingOre
The nap takers are here to... welp.

"Build a ladder to the moon" is simple as a sentence, but actually doing it is not.