share/hedgewars/Data/Maps/Basketball/map.lua
author Henek
Sat, 11 Dec 2010 14:03:49 +0100
changeset 4506 37744d5c877e
parent 4502 759c1a3bb156
child 8349 a1dbe148f10f
permissions -rw-r--r--
Finnished up the lua translations by adding training maps, campaign is ignored for now
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4506
37744d5c877e Finnished up the lua translations by adding training maps, campaign is ignored for now
Henek
parents: 4502
diff changeset
     1
-- Hedgewars - Basketball for 2+ Players
3000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
     2
4506
37744d5c877e Finnished up the lua translations by adding training maps, campaign is ignored for now
Henek
parents: 4502
diff changeset
     3
loadfile(GetDataPath() .. "Scripts/Locale.lua")()
3000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
     4
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
     5
local score = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0}
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
     6
3240
smxx
parents: 3235
diff changeset
     7
local started = false
smxx
parents: 3235
diff changeset
     8
3000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
     9
function onGameInit()
3003
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    10
	GameFlags = gfSolidLand + gfBorder + gfInvulnerable + gfLowGravity
3000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    11
	TurnTime = 20000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    12
	CaseFreq = 0
4162
923db448ad16 update and fix some lua stuff
Henek
parents: 3465
diff changeset
    13
	MinesNum = 0
3000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    14
	Explosives = 0
3003
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    15
	Delay = 500
3197
smxx
parents: 3050
diff changeset
    16
	SuddenDeathTurns = 99999 -- "disable" sudden death
3000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    17
end
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    18
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    19
function onGameStart()
4502
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents: 4493
diff changeset
    20
	ShowMission(loc("Hedgewars-Basketball"), loc("Not So Friendly Match"), loc("Bat your opponents through the|baskets and out of the map!"), -amBaseballBat, 0)
3240
smxx
parents: 3235
diff changeset
    21
	started = true
3000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    22
end
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    23
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    24
function onGameTick()
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    25
end
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    26
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    27
function onAmmoStoreInit()
3346
967fd96f7373 Engine/Frontend:
smxx
parents: 3266
diff changeset
    28
	SetAmmo(amBaseballBat, 9, 0, 0, 0)
967fd96f7373 Engine/Frontend:
smxx
parents: 3266
diff changeset
    29
	SetAmmo(amSkip, 9, 0, 0, 0)
3000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    30
end
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    31
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    32
function onGearAdd(gear)
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    33
end
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    34
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    35
function onGearDelete(gear)
3240
smxx
parents: 3235
diff changeset
    36
	if not started then
smxx
parents: 3235
diff changeset
    37
		return
3257
smxx
parents: 3240
diff changeset
    38
	end
3003
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    39
	if (GetGearType(gear) == gtHedgehog) and CurrentHedgehog ~= nil then
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    40
		local clan = GetHogClan(CurrentHedgehog)
4502
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents: 4493
diff changeset
    41
		local s
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents: 4493
diff changeset
    42
		if clan ~= nil then
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents: 4493
diff changeset
    43
			if GetHogClan(CurrentHedgehog) ~= GetHogClan(gear) then
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents: 4493
diff changeset
    44
				score[clan] = score[clan] + 1
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents: 4493
diff changeset
    45
				s = string.format(loc("%s is out and Team %d|scored a point!| |Score:"), GetHogName(gear), clan + 1)
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents: 4493
diff changeset
    46
			else
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents: 4493
diff changeset
    47
				score[clan] = score[clan] - 1
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents: 4493
diff changeset
    48
				s = string.format(loc("%s is out and Team %d|scored a penalty!| |Score:"), GetHogName(gear), clan + 1)
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents: 4493
diff changeset
    49
			end
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents: 4493
diff changeset
    50
			s = s .. " " .. score[0]
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents: 4493
diff changeset
    51
			for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents: 4493
diff changeset
    52
			ShowMission(loc("Hedgewars-Basketball"), loc("Not So Friendly Match"), s, -amBaseballBat, 0)
3003
0afdba08a858 Engine:
smxx
parents: 3000
diff changeset
    53
		end
3000
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    54
	end
2b9405b6dc5d General:
smxx
parents: 2999
diff changeset
    55
end