Missile inaccuracy patch

Missile inaccuracy patch

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
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Missile inaccuracy patch

Post by KDR_11k »

Smoth said I have to post this here to get it included in the SVN so here it goes:

Code: Select all

Index: MissileLauncher.cpp
===================================================================
--- MissileLauncher.cpp	(revision 3404)
+++ MissileLauncher.cpp	(working copy)
@@ -52,6 +52,11 @@
 			dir.Normalize();
 		}
 	}
+
+	dir+=(gs->randVector()*sprayangle+salvoError)*(1-owner->limExperience*0.5f); //Applies the weapon's
+		//inaccuracy to the projectile
+	dir.Normalize();
+
 	float3 startSpeed=dir*weaponDef->startvelocity;
 	if(onlyForward && dynamic_cast<CAirMoveType*>(owner->moveType))
 		startSpeed+=owner->speed;
I just made accuracy and sprayangle affect missile weapons, previously they were ignored and several modders complained about that. Would be nice if similar changes were applied to beamlasers and flamers.
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Post by MadRat »

bump, just to show community love
User avatar
ILMTitan
Spring Developer
Posts: 410
Joined: 13 Nov 2004, 08:35

Post by ILMTitan »

Committed, thank you.
As for beam lasers, they already obey accuracy, and burst fire does not seem to work with them (I have not done a whole lot of testing on this, so I could be wrong), so the sprayangle section does not seem to affect anything.
As for flamers, sprayangle and accuracy both seem to affect the speed at which the flame spreads out, so I'm not sure how to add accuracy to that as well.
Post Reply

Return to “Engine”