Engine:
* Avoid Homerun event if permanent low gravity is enabled
* Added CurrentHedgehog to script globals (contains uid)
Maps:
* Rewrote Basketball scoring message (didn't count right anyway)
--- a/hedgewars/HHHandlers.inc Tue Mar 16 04:46:29 2010 +0000
+++ b/hedgewars/HHHandlers.inc Tue Mar 16 19:28:15 2010 +0000
@@ -588,7 +588,7 @@
if (Gear^.State and gstDrowning) <> 0 then isCursorVisible:= false
end;
-if (hwAbs(Gear^.dY) > _0) and (Gear^.FlightTime > 0) then
+if (hwAbs(Gear^.dY) > _0) and (Gear^.FlightTime > 0) and ((GameFlags and gfLowGravity) = 0) then
begin
inc(Gear^.FlightTime, 1);
if Gear^.FlightTime = 2000 then
--- a/hedgewars/uScript.pas Tue Mar 16 04:46:29 2010 +0000
+++ b/hedgewars/uScript.pas Tue Mar 16 19:28:15 2010 +0000
@@ -351,6 +351,12 @@
lua_settop(luaState, 0)
end;
+procedure ScriptSetNil(name : shortstring);
+begin
+lua_pushnil(luaState);
+lua_setglobal(luaState, Str2PChar(name));
+end;
+
procedure ScriptSetInteger(name : shortstring; value : LongInt);
begin
lua_pushinteger(luaState, value);
@@ -443,6 +449,10 @@
procedure SetGlobals;
begin
ScriptSetInteger('TurnTimeLeft', TurnTimeLeft);
+if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) then
+ ScriptSetInteger('CurrentHedgehog', CurrentHedgehog^.Gear^.UID)
+else
+ ScriptSetNil('CurrentHedgehog');
end;
procedure GetGlobals;
--- a/share/hedgewars/Data/Maps/Basketball/map.lua Tue Mar 16 04:46:29 2010 +0000
+++ b/share/hedgewars/Data/Maps/Basketball/map.lua Tue Mar 16 19:28:15 2010 +0000
@@ -20,7 +20,12 @@
["de"] = " erhält einen Punkt!"
}
-local sscore = {
+local failed = {
+ ["en"] = " scored a penalty!",
+ ["de"] = " erhält eine Strafe!"
+ }
+
+ local sscore = {
["en"] = "Score",
["de"] = "Punktestand"
}
@@ -46,12 +51,12 @@
local score = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0}
function onGameInit()
- GameFlags = gfSolidLand + gfBorder + gfInvulnerable + gfRandomOrder + gfLowGravity
+ GameFlags = gfSolidLand + gfBorder + gfInvulnerable + gfLowGravity
TurnTime = 20000
CaseFreq = 0
LandAdds = 0
Explosives = 0
- Delay = 0
+ Delay = 500
end
function onGameStart()
@@ -63,17 +68,25 @@
function onAmmoStoreInit()
SetAmmo(amBaseballBat, 9, 0, 0)
+ SetAmmo(amSkip, 9, 0, 0)
end
function onGearAdd(gear)
end
function onGearDelete(gear)
- if GetGearType(gear) == gtHedgehog then
- local clan = GetHogClan(gear)
- score[clan] = score[clan] + 1
- local s = loc(sscore) .. ": " .. score[0]
+ if (GetGearType(gear) == gtHedgehog) and CurrentHedgehog ~= nil then
+ local clan = GetHogClan(CurrentHedgehog)
+ local s = GetHogName(gear) .. " " .. loc(drowning) .. "|" .. loc(team) .. " " .. (clan + 1) .. " "
+ if GetHogClan(CurrentHedgehog) ~= GetHogClan(gear) then
+ score[clan] = score[clan] + 1
+ s = s .. loc(scored)
+ else
+ score[clan] = score[clan] - 1
+ s = s .. loc(failed)
+ end
+ s = s .. "| |" .. loc(sscore) .. ": " .. score[0]
for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end
- ShowMission(loc(caption), loc(subcaption), GetHogName(gear) .. " " .. loc(drowning) .. "|" .. loc(team) .. " " .. (clan + 1) .. " " .. loc(scored) .. "| |" .. s, -amBaseballBat, 0)
+ ShowMission(loc(caption), loc(subcaption), s, -amBaseballBat, 0)
end
end