soundmud/soundrts — pull request #50 by craigbrett17 (2014-09-21 19:11:30+00:00)
Title: New feature: Build limits

Something I would've requested, but I thought it seemed easy enough for me to give it a try myself.

For certain types of units or structures, it would be nice to be able to enforce a build limit per player for this particular type. An example is below:

def archmage
class soldier
damage 100
damage_radius 1
splash 1
cooldown 5
... ; other super stats
build_limit 1 ; only allowed to build one of these! could be any other positive number

This way, super powerful units can be limited by more than food if desired. The same works for buildings.

def nuclear_missile_silo
class building
...
build_limit 1

This is useful for hero type units, or very powerful structures. Or if you want to restrict building of unit production buildings to a number fitting of their faction (i.e orcs might have greater numbers so can build more barracks than humans).

These are my first real lines of Python, so I hope I've stuck to the correct coding standards for the project and the language.

Hope this comes in useful!