Add tag "Power" to unit definitions

Add tag "Power" to unit definitions

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

Add tag "Power" to unit definitions

Post by PauloMorfeo »

We have in class CUnit:

Code: Select all

	float power;						//indicate the relative power of the unit, used for experience calulations etc
And in:
void CUnitDefHandler::ParseTAUnit(std::string file, int id)

Code: Select all

	ud.power = (ud.metalCost + ud.energyCost/60.0f);
	if(ud.power<1e-3f){
		...
		ud.power=1e-3f;
	}
If "Power" is loaded from the unit definition, we could control ourselves how much each unit gives of XP to enemies or, for example, remove completely experience by making all units have really low "Power" (0.001 or something?).

Should be easy to do and very similar to the adition of mass to features (wouldn't also change anything in the inner works of Spring):
How about something like this? (it compiles ;-) )

Code: Select all

    const string massStr = wreckParser.SGetValueDef("", name + "\\Mass");   
    if (massStr.empty()) {
      // generate the mass from the metal and health values
      fd->mass = (fd->metal * 0.4f) + (fd->maxHealth * 0.1f);
    } else {
      fd->mass = (float)atof(massStr.c_str()); 
    }
    fd->mass = max(0.001f, fd->mass);
P.S. I haven't actually checked if the max() safety is required
renrutal
Posts: 84
Joined: 28 Apr 2005, 16:45

Post by renrutal »

Sometimes I think the devs should just find a way to add support to user made variables.
User avatar
SwiftSpear
Classic Community Lead
Posts: 7287
Joined: 12 Aug 2005, 09:29

Post by SwiftSpear »

renrutal wrote:Sometimes I think the devs should just find a way to add support to user made variables.
It's called the OSRTS project.
User avatar
hrmph
Posts: 1054
Joined: 12 May 2005, 20:08

Post by hrmph »

SwiftSpear wrote:It's called the OSRTS project.
I wish they would choose that name as the permanent one! Sounds a lot better than command IMO. ;) (/offtopic)
Post Reply

Return to “Feature Requests”