More control over aircraft deaths - Page 2

More control over aircraft deaths

Requests for features in the spring code.

Moderator: Moderators

User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

break is generally seen as a bad way of programming.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

omg since when? knuth didn't like goto, but break...?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

If you have to break out of a loop that generally means either;

The condition for the loop is flawed.

or

you're forcing your way out of an infinite loop, which implies that the condition for the loop is flawed.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Code: Select all

while (true) break;

if (true) {
	this=that;
	break;
	that=this;
}
for (a=0; a < 10; ++a) {
	if (a == 5) break;
}
Break does have it's uses, i.e. if you go through a list (or an array) to find a member of it and then want to literally break out of the loop (not the function, break doesn't work like that) instead of going through all the remaining elements. Or switch, which Cavedog should have added to COB, ffs. :P
manored
Posts: 3179
Joined: 15 Nov 2006, 00:37

Post by manored »

How about making falling units health bars to not go crazy and anyoing then they are falling too? :)

Also, why stop at aircraft? Death animations for ships and big ground units would be cool too :)
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

Death animations for everything else are easily scripted; the only reason the aircraft one is there is because it is not possible to implement through the script.
j5mello
Posts: 1189
Joined: 26 Aug 2005, 05:40

Post by j5mello »

isn't that what Killed() is for???? (the uber death anims for surface units)
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

Precisely.
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Post by yuritch »

Ok, here is the patch. I cannot test it now as I made it at work (and my boss won't understand why I need to start something that looks surprisingly like a game on a workstation), so if somebody could compile and test it, please do so.
Basically it introduces a new set/get constant, CRASHING (96).

Code: Select all

get CRASHING
returns 1 for a crashing plane, 0 otherwise.

Code: Select all

set CRASHING to 1
starts a plane's crashing sequence. I'm not sure whether

Code: Select all

set CRASHING to 0
will abort it or not.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Yay!
User avatar
Snipawolf
Posts: 4357
Joined: 12 Dec 2005, 01:49

Post by Snipawolf »

Oh yeah baby!

Flinging part off, emit-sfx, and more!
manored
Posts: 3179
Joined: 15 Nov 2006, 00:37

Post by manored »

Now how about pilot kbots jumping off the cockpit? :)
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Post by Neddie »

manored wrote:Now how about pilot kbots jumping off the cockpit? :)
Spawning a new unit using LUA, then animating a fall of it, unhiding the real one when it hits earth.
Post Reply

Return to “Feature Requests”