roman-murashov / hedgewars

Automatically exported from code.google.com/p/hedgewars
GNU General Public License v2.0
0 stars 0 forks source link

Update TargetPractice.lua #948

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Sheepluva told me that there was a problem with the target practice missions: 
When a target dropped into water (this could happen if the land below was 
destroyed before the target spawned), the mission could not continue, the 
player could only abort or suicide or wait for the timer to run out.

I have fixed this issue by a simple trick: Whenever a target drops into water, 
the target will respawn, but a girder is placed directly below it. A target 
which drops into water does not count as "destroyed", so the player must still 
shoot it to continue.

Further minior changes I made:
- Play sndFlawless when mission is completed with 100% accuracy
- Disable hog controls when mission is finished
- Some typo fixes, especially in the big comments
- Minor code clean-up

Here's the updated code (based on 0.9.21 code):

http://lpaste.net/raw/137395

Original issue reported on code.google.com by almikes@aol.com on 27 Jul 2015 at 3:59

GoogleCodeExporter commented 8 years ago
I'm curious why you didn't just use onGearDelete or make the land 
indestructible, but if your solution works and you like it I don't have 
anything against it, haha. I haven't tested it, but just skimming over the code 
it looks like you missed the closing bracket on one of the "You lose" loc() 
calls. Please test submitted stuff >_<.

Original comment by RedGrin...@gmail.com on 28 Jul 2015 at 2:57

GoogleCodeExporter commented 8 years ago
I want to keep the option to have destructible land to make things slightly 
more interesting.

I fixed the loc() issue. Oops!

Did you mean this?:

                AddCaption(loc("You lose!", 0xFFFFFFFF, capgrpGameState))

Haha, the fun thing is, this is not a syntax error. The arguments are obviously 
false, but the code still works. Yes, I *have* tested my code before 
submitting. The 2nd and 3rd arguments into loc() are probably just discarded 
and AddCaption only takes one argument here, which is also valid. The only 
thing that's actually different is the caption group, which will be 
capgrpMessage instead of capgrpGameState. There is no visible difference in the 
actual mission.

Anyways, I have fixed it, because this line is still an obvious bracket 
mistake. xD

Original comment by almikes@aol.com on 29 Jul 2015 at 12:33