GET/SET Unitspeed

GET/SET Unitspeed

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
Archangel of Death
Posts: 854
Joined: 28 Jan 2005, 18:15

GET/SET Unitspeed

Post by Archangel of Death »

In version .67b1:
0.67b1
...
-COB support for Getting/Setting veteran level and unit speed.
The returned veteran level is unit experience multiplied by 100
Unit speed can be set to something nonzero only when the current speed is nonzero, it can always be set to zero.
...
Relevant code:

Code: Select all

void CCobInstance::SetUnitVal(int val, int param)
{
#ifndef _CONSOLE
	switch(val)
	{
	case ACTIVATION:
		if (param == 0)
			unit->Deactivate();
		else
			unit->Activate();
		break;
	case STANDINGMOVEORDERS:
		break;
	case STANDINGFIREORDERS:
		break;
	case HEALTH:
		break;
	case INBUILDSTANCE:
		//info->AddLine("buildstance %d", param);
		unit->inBuildStance = (param != 0);
		break;
	case BUSY:
		busy = (param != 0);
		break;
	case PIECE_XZ:
		break;
	case PIECE_Y:
		break;
	case UNIT_XZ:
		break;
	case UNIT_Y:
		break;
	case UNIT_HEIGHT:
		break;
	case XZ_ATAN:
		break;
	case XZ_HYPOT:
		break;
	case ATAN:
		break;
	case HYPOT:
		break;
	case GROUND_HEIGHT:
		break;
	case BUILD_PERCENT_LEFT:
		break;
	case YARD_OPEN:
		if (param == 0) {
			if (uh->CanCloseYard(unit))
				yardOpen = false;
		}
		else {
			yardOpen = true;
		}
		break;
	case BUGGER_OFF:
		if (param != 0) {
			helper->BuggerOff(unit->pos+unit->frontdir*unit->radius,unit->radius*1.5);
		}
		//yardOpen = (param != 0);
		break;
	case ARMORED:
		if(param){
			unit->curArmorMultiple=unit->armoredMultiple;
		} else {
			unit->curArmorMultiple=1;
		}
		unit->armoredState = (param != 0);
		break;
	default:
		info->AddLine("CobError: Unknown set constant %d", val);
	case VETERAN_LEVEL: 
		unit->experience=param*0.01f;
		break;
	}
#endif
}
That is the code that handles all the SET's from the script. It seems to be missing a case for CURRENT_SPEED. I'm told zwzsg already discovered that it doesn't work. I had big plans for this functionality. Perhaps it can be fixed?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Better than that... we shouldn't be setting current speed, we should be setting/getting maximum speed, and probably also have a way to set/get acceleration/deceleration.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

Setting unit speed was a quick experiment that didn't work out, removed after 0.67b1

I was hoping the vehicle code used the current unitspeed for its behavior.However the vehicle code updates the unitspeed with it's own data every frame, so it doesn't work.
Archangel of Death
Posts: 854
Joined: 28 Jan 2005, 18:15

Post by Archangel of Death »

Ah, darn. Well... there went MASC's and limping and afterburners...
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Post by bobthedinosaur »

nooooooooo!!
User avatar
FizWizz
Posts: 1998
Joined: 17 Aug 2005, 11:42

Post by FizWizz »

I don't care much about limping or overthrust/flank/run, but it's a shame about MASC.
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Post by Warlord Zsinj »

I wonder if it is still possible to have a different speed for a unit that is crawling compared to a speed for the same unit that is walking (ie: under fire/not under fire) or something similar.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Has this bug been fixed?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

I think so, it's in the changelog for 73. Why don't you just try if it works?
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Post by Caydr »

KDR_11k wrote:I think so, it's in the changelog for 73. Why don't you just try if it works?
Probably because doing so would be a lengthy process (30 mins?) which is dependant on knowing how to address the new code. Which is unknown.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

No, it's mainly because I'm so darn busy working on GPL'd Includes to get rid of all of the OTA Includes, checking the CobInstance code to determine what exactly is being done with certain things... and preparing for my new code release and NanoBlobs 0.6 ... basically, I'm super-busy. Sorry, know that's lame, but I just don't have time to mess with the dev build again at the moment, what I'm doing is too important for Spring modding on the whole.
User avatar
Nemo
Spring 1944 Developer
Posts: 1376
Joined: 30 Jan 2005, 19:44

Post by Nemo »

get/set MAX_SPEED 75 works in the new version. In the current dev build up for download, it rounds anything it touches with a velocity under 1 down to 0 (greatly confused flozi and I for a while, since our infantry kept getting 'stuck'), but yeha has already fixed that in the svn.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Thanks for answering that question.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Nemo wrote:get/set MAX_SPEED 75 works in the new version. In the current dev build up for download, it rounds anything it touches with a velocity under 1 down to 0 (greatly confused flozi and I for a while, since our infantry kept getting 'stuck'), but yeha has already fixed that in the svn.
nemo's back :mrgreen:
Post Reply

Return to “Engine”