share/hedgewars/Data/Maps/Knockball/map.lua
author smxx
Tue, 16 Mar 2010 21:39:55 +0000
changeset 3004 e9b3613cc3fb
child 3013 dfc1f16aeb53
permissions -rw-r--r--
Engine: * Updated Ball Gun balls: Now rotate depending on velocity (looks better imo but could revert that change as well) * Allow explosions without spawning gears (visuals) * Added some script additions Maps: * Updated Basketball's CMakeLists.txt * Added experimental Knockball map
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3004
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
     1
-- Hedgewars - Knockball for 2+ Players
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
     2
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
     3
local caption = {
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
     4
	["en"] = "Hedgewars-Knockball",
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
     5
	["de"] = "Hedgewars-Knockball"
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
     6
	}
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
     7
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
     8
local subcaption = {
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
     9
	["en"] = "Not So Friendly Match",
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    10
	["de"] = "Kein-so-Freundschaftsspiel"
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    11
	}
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    12
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    13
local goal = {
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    14
	["en"] = "Bat balls at your enemies and|push them into the sea!",
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    15
	["de"] = "Schlage Bälle auf deine Widersacher|und lass sie ins Meer fallen!"
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    16
	}
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    17
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    18
local scored = {
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    19
	["en"] = " scored a point!",
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    20
	["de"] = " erhält einen Punkt!"
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    21
	}
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    22
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    23
local failed = {
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    24
	["en"] = " scored a penalty!",
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    25
	["de"] = " erhält eine Strafe!"
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    26
	}
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    27
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    28
	local sscore = {
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    29
	["en"] = "Score",
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    30
	["de"] = "Punktestand"
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    31
	}
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    32
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    33
local team = {
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    34
	["en"] = "Team"
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    35
	}
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    36
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    37
local drowning = {
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    38
	["en"] = "is out and",
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    39
	["de"] = "ist draußen und"
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    40
	}
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    41
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    42
local function loc(text)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    43
	if text == nil then return "**missing**"
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    44
	elseif text[L] == nil then return text["en"]
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    45
	else return text[L]
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    46
	end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    47
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    48
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    49
---------------------------------------------------------------
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    50
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    51
local score = {[0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0}
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    52
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    53
local ball = nil
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    54
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    55
function onGameInit()
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    56
	GameFlags = gfSolidLand + gfInvulnerable + gfDivideTeams
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    57
	TurnTime = 20000
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    58
	CaseFreq = 0
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    59
	LandAdds = 0
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    60
	Explosives = 0
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    61
	Delay = 500
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    62
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    63
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    64
function onGameStart()
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    65
	ShowMission(loc(caption), loc(subcaption), loc(goal), -amBaseballBat, 0);
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    66
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    67
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    68
function onGameTick()
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    69
	if ball ~= nil then FollowGear(ball) end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    70
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    71
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    72
function onAmmoStoreInit()
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    73
	SetAmmo(amBaseballBat, 9, 0, 0)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    74
	SetAmmo(amSkip, 9, 0, 0)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    75
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    76
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    77
function onGearAdd(gear)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    78
	if GetGearType(gear) == gtShover then
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    79
		ball = AddGear(GetX(gear), GetY(gear), gtBall, 0, 0, 0, 0)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    80
		if ball ~= nil then
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    81
			CopyPV2(gear, ball)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    82
			SetState(ball, 0x200) -- temporary - might change!
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    83
			SetTag(ball, 8) -- baseball skin
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    84
		end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    85
	end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    86
end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    87
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    88
function onGearDelete(gear)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    89
	if gear == ball then
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    90
		ball = nil
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    91
	elseif (GetGearType(gear) == gtHedgehog) and CurrentHedgehog ~= nil then
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    92
		local clan = GetHogClan(CurrentHedgehog)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    93
		local s = GetHogName(gear) .. " " .. loc(drowning) .. "|" .. loc(team) .. " " .. (clan + 1) .. " "
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    94
		if GetHogClan(CurrentHedgehog) ~= GetHogClan(gear) then
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    95
			score[clan] = score[clan] + 1
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    96
			s = s .. loc(scored)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    97
		else
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    98
			score[clan] = score[clan] - 1
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
    99
			s = s .. loc(failed)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
   100
		end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
   101
		s = s .. "| |" .. loc(sscore) .. ": " .. score[0]
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
   102
		for i = 1, ClansCount - 1 do s = s .. " - " .. score[i] end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
   103
		ShowMission(loc(caption), loc(subcaption), s, -amBaseballBat, 0)
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
   104
	end
e9b3613cc3fb Engine:
smxx
parents:
diff changeset
   105
end