Ammo Re-Write

Outline Of What-It-Does:

  1. every unit has a fixed amount of ammo, reduced when fired
  2. when it gets under a certain point, starts firing more and more slowly, until it stops entirely at 0
  3. near supply units, ammo regenerates while those units drain energy. if energy is gone, they stop supplying

(More discussion to come obviously)

I think ammo should be not based on energy at all, but should use a energy system simalar to KDR’s Fibre Mod.

It would also keep engineers busy late game.

Any thoughts?

Sorry, this thread is meant to be more about the technical implementation.

anyway, this is how i see it working.

  • Unit with ammo is created - lua gadget registers this as currently
  • The current ammo level is kept track of lua side
  • The cob tells lua when the weapon has fired, lua depletes the ammo accordingly
  • lua alters the reload rate when under lowAmmoLimit
  • lua tells cob when ammo is exhausted - cob locks the weapon
  • resupply works as currently
  • lua tells cob when ammo is increased - cob unlocks weapon, lua changes reload rate.

It’s open to debate though; it may be better do everything apart from resupply cob side.

Sorry, I’ll just start a new thread.

As I guess you’ve already noted, the ammo display should be separate from the ammo calculations. Currently they are crammed into the same file, which is not good. If at all possible the ammo display and noammo.lua should be combined as well.

It looks like the re-write may be put on hold for a while anyway as I think I finally debugged the current setup.