author | unC0Rr |
Tue, 27 Aug 2019 08:41:48 +0200 | |
changeset 15365 | fcdb6e3a9d36 |
parent 14401 | 6c21bd8547dd |
permissions | -rw-r--r-- |
4506
37744d5c877e
Finnished up the lua translations by adding training maps, campaign is ignored for now
Henek
parents:
4502
diff
changeset
|
1 |
-- Hedgewars - Knockball for 2+ Players |
3263 | 2 |
|
9093 | 3 |
HedgewarsScriptLoad("/Scripts/Locale.lua") |
3263 | 4 |
|
5 |
local ball = nil |
|
6 |
||
7 |
function onGameInit() |
|
8 |
GameFlags = gfSolidLand + gfInvulnerable + gfDivideTeams |
|
9 |
TurnTime = 20000 |
|
10 |
CaseFreq = 0 |
|
4162 | 11 |
MinesNum = 0 |
3263 | 12 |
Explosives = 0 |
12079
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
12077
diff
changeset
|
13 |
-- Disable Sudden Death |
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
12077
diff
changeset
|
14 |
WaterRise = 0 |
8f222872d432
Disable SD for a couple of scripts and mission maps
Wuzzy <almikes@aol.com>
parents:
12077
diff
changeset
|
15 |
HealthDecrease = 0 |
3263 | 16 |
end |
17 |
||
18 |
function onGameStart() |
|
12077
ce3860c82c8b
Rewrite 2nd line of mission panel of most missions for consistency
Wuzzy <almikes@aol.com>
parents:
11198
diff
changeset
|
19 |
ShowMission(loc("Knockball"), loc("Not So Friendly Match"), loc("Bat balls at your enemies and|push them into the sea!"), -amBaseballBat, 0) |
12082
c680b7db1e2e
Add custom ammo texts for Knockball
Wuzzy <almikes@aol.com>
parents:
12081
diff
changeset
|
20 |
SetAmmoTexts(amBaseballBat, loc("Baseball Bat with Ball"), loc("Knockball weapon"), loc("Throw a baseball at your foes|and send them flying!") .. "|" .. loc("Attack: Throw ball")) |
3263 | 21 |
end |
22 |
||
23 |
function onGameTick() |
|
24 |
if ball ~= nil and GetFollowGear() ~= nil then FollowGear(ball) end |
|
25 |
end |
|
26 |
||
27 |
function onAmmoStoreInit() |
|
3346 | 28 |
SetAmmo(amBaseballBat, 9, 0, 0, 0) |
29 |
SetAmmo(amSkip, 9, 0, 0, 0) |
|
3263 | 30 |
end |
31 |
||
32 |
function onGearAdd(gear) |
|
33 |
if GetGearType(gear) == gtShover then |
|
7777 | 34 |
ball = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtBall, 0, 0, 0, 0) |
3263 | 35 |
if ball ~= nil then |
4517
0618b31023dc
added team flag to AddTeam and made AI team allowed to have custom flags. added GetGearVelocity and SetGearVelocity and removed CopyPV2. changed knockball to use use these functions instead.
Henek
parents:
4506
diff
changeset
|
36 |
local dx, dy = GetGearVelocity(gear) |
0618b31023dc
added team flag to AddTeam and made AI team allowed to have custom flags. added GetGearVelocity and SetGearVelocity and removed CopyPV2. changed knockball to use use these functions instead.
Henek
parents:
4506
diff
changeset
|
37 |
SetGearVelocity(ball, dx * 2, dy * 2) |
3263 | 38 |
SetState(ball, 0x200) -- temporary - might change! |
39 |
SetTag(ball, 8) -- baseball skin |
|
40 |
FollowGear(ball) |
|
41 |
end |
|
42 |
end |
|
43 |
end |
|
44 |
||
45 |
function onGearDelete(gear) |
|
46 |
if gear == ball then |
|
47 |
ball = nil |
|
48 |
end |
|
49 |
end |
|
11198
cc308446f90d
preselect baseball bat in Knockball and Basketball
sheepluva
parents:
9093
diff
changeset
|
50 |
|
cc308446f90d
preselect baseball bat in Knockball and Basketball
sheepluva
parents:
9093
diff
changeset
|
51 |
function onNewTurn() |
cc308446f90d
preselect baseball bat in Knockball and Basketball
sheepluva
parents:
9093
diff
changeset
|
52 |
SetWeapon(amBaseballBat) |
cc308446f90d
preselect baseball bat in Knockball and Basketball
sheepluva
parents:
9093
diff
changeset
|
53 |
end |