1--       _________ __                 __
2--      /   _____//  |_____________ _/  |______     ____  __ __  ______
3--      \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
4--      /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
5--     /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
6--             \/                  \/          \//_____/            \/
7--  ______________________                           ______________________
8--                        T H E   W A R   B E G I N S
9--         Stratagus - A free fantasy real time strategy game engine
10--
11--      units.lua - Define the used unit-types.
12--
13--      (c) Copyright 1998-2005 by Lutz Sammer and Jimmy Salmon
14--
15--      This program is free software; you can redistribute it and/or modify
16--      it under the terms of the GNU General Public License as published by
17--      the Free Software Foundation; either version 2 of the License, or
18--      (at your option) any later version.
19--
20--      This program is distributed in the hope that it will be useful,
21--      but WITHOUT ANY WARRANTY; without even the implied warranty of
22--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23--      GNU General Public License for more details.
24--
25--      You should have received a copy of the GNU General Public License
26--      along with this program; if not, write to the Free Software
27--      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28--
29
30UnitTypeFiles = {}
31
32function ShadowDefinition(scale)
33   if wc2.preferences.UseFancyShadows then
34      return {"offset", {3, 21}, "scale", 1}
35   else
36      return {"file", "missiles/unit_shadow.png", "size", {32, 32}, "offset", {-3 * (scale + 1), 10 * (scale + 1)}, "sprite-frame", scale}
37   end
38end
39
40-- animations for units need to spawn the appropriate death revealer when the
41-- death animation starts. These monkey patches on DefineAnimations and
42-- DefineUnitType take care of inserting the appropriate spawn in the Death
43-- animation of each unit
44local OldDefineUnitType = DefineUnitType
45local OldDefineAnimations = DefineAnimations
46
47local animationspecs = {}
48function DefineAnimations(name, tbl)
49   animationspecs[name] = tbl
50end
51local function tableShallowCopy(tbl)
52   res = {}
53   for k,v in pairs(tbl) do
54      res[k] = v
55   end
56   return res
57end
58function DefineUnitType(name, tbl)
59   local sight = tbl["SightRange"]
60   local size = tbl["TileSize"][1]
61   local animName = tbl["Animations"]
62   local animSpec = animationspecs[animName]
63   if animSpec == nil then
64      error("No animation " .. animName .. " defined for unit " .. name)
65   end
66   local animDeath = animSpec["Death"]
67   local corpse = tbl["Corpse"]
68   local explodeWhenKilled = tbl["ExplodeWhenKilled"]
69   local vanishes = tbl["Vanishes"] or tbl["Revealer"]
70   if (animDeath or corpse or explodeWhenKilled) and not vanishes and sight > 0 then
71      -- the unit has a Death animation or a corpse and is not itself a corpse
72      -- that vanishes, so we want to spawn a dead vision revealer.
73      animSpec = tableShallowCopy(animSpec) -- shallow copy of the anim table, because we'll replace the Death anim
74      if animDeath ~= nil then
75         animDeath = tableShallowCopy(animDeath) -- shallow copy of the death animations, because we'll insert the dead vision
76      else
77         animDeath = {"wait 1"} -- we need to wait 1 otherwise we won't finish
78      end
79
80      -- we just redefine always. the existing unit and animation will be
81      -- overridden with the same values
82      local deadVisionName = "unit-dead-vision-" .. size .. "-" .. sight
83      OldDefineAnimations("animations-dead-vision", { Still = { "frame 0", "wait 80", "set-var SightRange.Max = 1", "wait 80", "die" } })
84      OldDefineUnitType(deadVisionName, {
85                           Name = "Reveal Death Location " .. size .. "-" .. sight,
86                           TileSize = {size, size},
87                           BoxSize = {size, size},
88                           SightRange = sight,
89                           Indestructible = true, NonSolid = true, SelectableByRectangle = false,
90                           BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
91                           Animations = "animations-dead-vision", Icon = "icon-holy-vision",
92                           Speed = 0, HitPoints = 1, Priority = 0, Type = tbl["Type"], VisibleUnderFog = true,
93                           Revealer = true, Vanishes = true, DetectCloak = false, Sounds = {}})
94
95      table.insert(animDeath, 1, "spawn-unit " .. deadVisionName .. " 0 0 0 l.this")
96      animSpec["Death"] = animDeath
97
98      local unitAnimName = animName .. "-size-" .. size .. "-sight-" .. sight
99      OldDefineAnimations(unitAnimName, animSpec)
100      tbl["Animations"] = unitAnimName
101      -- print("Updating Death animation with revealer " .. deadVisionName .. " for " .. name .. " with " .. unitAnimName)
102   else
103      -- print("NOT updating Death animation with revealer for " .. name)
104      OldDefineAnimations(animName, animSpec)
105   end
106
107   return OldDefineUnitType(name, tbl)
108end
109
110-- Load the animations for the units.
111Load("scripts/anim.lua")
112
113--=============================================================================
114--	Define unit-types.
115--
116--	NOTE: Save can generate this table.
117--
118DefineUnitType("unit-nothing-22", { Name = _("Nothing 22"),
119  Animations = "animations-building", Icon = "icon-cancel",
120  Speed = 99,
121  HitPoints = 10,
122  DrawLevel = 0,
123  TileSize = {0, 0}, BoxSize = {0, 0},
124  SightRange = 0,
125  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
126  Priority = 0,
127  Type = "land",
128  Sounds = {} } )
129
130DefineUnitType("unit-nothing-24", { Name = _("Nothing 24"),
131  Animations = "animations-building", Icon = "icon-cancel",
132  Costs = {"time", 60, "gold", 400},
133  Speed = 99,
134  HitPoints = 60,
135  DrawLevel = 10,
136  TileSize = {1, 1}, BoxSize = {63, 63},
137  SightRange = 4, ComputerReactionRange = 20, PersonReactionRange = 10,
138  Armor = 2, BasicDamage = 9, PiercingDamage = 1, Missile = "missile-none",
139  MaxAttackRange = 1,
140  Priority = 40,
141  Type = "naval",
142  SeaUnit = true,
143  SelectableByRectangle = true,
144  Sounds = {} } )
145
146DefineUnitType("unit-nothing-25", { Name = _("Nothing 25"),
147  Animations = "animations-building", Icon = "icon-cancel",
148  Costs = {"time", 60, "gold", 400},
149  Speed = 99,
150  HitPoints = 60,
151  DrawLevel = 10,
152  TileSize = {1, 1}, BoxSize = {63, 63},
153  SightRange = 4, ComputerReactionRange = 20, PersonReactionRange = 10,
154  Armor = 2, BasicDamage = 9, PiercingDamage = 1, Missile = "missile-none",
155  MaxAttackRange = 1,
156  Priority = 40,
157  Type = "naval",
158  SeaUnit = true,
159  SelectableByRectangle = true,
160  Sounds = {} } )
161
162DefineUnitType("unit-nothing-30", { Name = _("Nothing 30"),
163  Animations = "animations-building", Icon = "icon-cancel",
164  Speed = 99,
165  HitPoints = 0,
166  Indestructible = 1,
167  DrawLevel = 10,
168  TileSize = {0, 0}, BoxSize = {0, 0},
169  SightRange = 0,
170  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
171  Priority = 0,
172  Type = "land",
173  Sounds = {} } )
174
175DefineUnitType("unit-nothing-36", { Name = _("Nothing 36"),
176  Animations = "animations-building", Icon = "icon-cancel",
177  Speed = 99,
178  HitPoints = 0,
179  Indestructible = 1,
180  DrawLevel = 10,
181  TileSize = {0, 0}, BoxSize = {0, 0},
182  SightRange = 0,
183  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
184  Priority = 0,
185  Type = "land",
186  Sounds = {} } )
187
188DefineUnitType("unit-daemon", { Name = _("Daemon"),
189  Image = {"file", "neutral/units/daemon.png", "size", {72, 72}},
190  Shadow = ShadowDefinition(1),
191  Animations = "animations-daemon", Icon = "icon-daemon",
192  Costs = {"time", 70, "gold", 500, "oil", 50},
193  NeutralMinimapColor = {192, 0, 0},
194  Speed = 14,
195  HitPoints = 60,
196  DrawLevel = 60,
197  TileSize = {1, 1}, BoxSize = {31, 31},
198  SightRange = 5, ComputerReactionRange = 7, PersonReactionRange = 5,
199  Armor = 3, BasicDamage = 10, PiercingDamage = 2, Missile = "missile-daemon-fire",
200  MaxAttackRange = 3,
201  Priority = 63,
202  Points = 100,
203  Demand = 1,
204  Type = "fly",
205  RightMouseAction = "attack",
206  CanAttack = true,
207  CanTargetLand = true, CanTargetSea = true, CanTargetAir = true,
208  AirUnit = true,
209  DetectCloak = true,
210  organic = true,
211  SelectableByRectangle = true,
212  Sounds = {
213    "selected", "daemon-selected",
214--    "acknowledge", "daemon-acknowledge",
215--    "ready", "daemon-ready",
216    "help", "basic orc voices help 1",
217    "dead", "daemon-dead"} } )
218
219
220UnitTypeFiles["unit-critter"] = {summer = "tilesets/summer/neutral/units/critter.png",
221  winter = "tilesets/winter/neutral/units/critter.png",
222  wasteland = "tilesets/wasteland/neutral/units/critter.png",
223  swamp = "tilesets/swamp/neutral/units/critter.png"}
224
225DefineUnitType("unit-critter", { Name = _("Critter"),
226  Image = {"size", {32, 32}},
227  Animations = "animations-critter", Icon = "icon-critter",
228  NeutralMinimapColor = {192, 192, 192},
229  Speed = 3,
230  HitPoints = 5,
231  DrawLevel = 35,
232  TileSize = {1, 1}, BoxSize = {31, 31},
233  SightRange = 2, ComputerReactionRange = 20, PersonReactionRange = 10,
234  BasicDamage = 80, PiercingDamage = 0, Missile = "missile-critter-explosion",
235  MaxAttackRange = 1,
236  Priority = 37,
237  Points = 1,
238  Demand = 1,
239  Type = "land",
240  RightMouseAction = "move",
241  CanTargetLand = true,
242  LandUnit = true,
243  RandomMovementProbability = 100,
244  ClicksToExplode = 10,
245  organic = true,
246  Sounds = {
247    "selected", "critter-selected",
248--    "acknowledge", "critter-acknowledge",
249--    "ready", "critter-ready",
250    "help", "critter-help",
251    "dead", "critter-dead"} } )
252
253
254UnitTypeFiles["unit-gold-mine"] = {summer = "tilesets/summer/neutral/buildings/gold_mine.png",
255  winter = "tilesets/winter/neutral/buildings/gold_mine.png",
256  wasteland = "tilesets/wasteland/neutral/buildings/gold_mine.png",
257  swamp = "tilesets/swamp/neutral/buildings/gold_mine.png"}
258
259DefineUnitType("unit-gold-mine", { Name = _("Gold Mine"),
260  Image = {"size", {96, 96}},
261  Animations = "animations-gold-mine", Icon = "icon-gold-mine",
262  NeutralMinimapColor = {255, 255, 0},
263  Neutral = true,
264  Costs = {"time", 150},
265  Construction = "construction-land2",
266  Speed = 0,
267  HitPoints = 25500,
268  DrawLevel = 40,
269  TileSize = {3, 3}, BoxSize = {95, 95},
270  SightRange = 1,
271  Armor = 20, BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
272  Priority = 0,
273  Corpse = "unit-destroyed-3x3-place",
274  ExplodeWhenKilled = "missile-explosion",
275  Type = "land",
276  Building = true, VisibleUnderFog = true,
277  BuildingRules = { { "distance", { Distance = 3, DistanceType = ">", Type = "unit-town-hall"}},
278					{ "distance", { Distance = 3, DistanceType = ">", Type = "unit-keep"}},
279					{ "distance", { Distance = 3, DistanceType = ">", Type = "unit-castle"}},
280					{ "distance", { Distance = 3, DistanceType = ">", Type = "unit-great-hall"}},
281					{ "distance", { Distance = 3, DistanceType = ">", Type = "unit-stronghold"}},
282					{ "distance", { Distance = 3, DistanceType = ">", Type = "unit-fortress"}}
283				  },
284
285  GivesResource = "gold", CanHarvest = true,
286  Sounds = {
287    "selected", "gold-mine-selected",
288--    "acknowledge", "gold-mine-acknowledge",
289--    "ready", "gold-mine-ready",
290    "help", "gold-mine-help",
291    "dead", "building destroyed"} } )
292
293
294UnitTypeFiles["unit-oil-patch"] = {summer = "tilesets/summer/neutral/buildings/oil_patch.png",
295  winter = "tilesets/summer/neutral/buildings/oil_patch.png",
296  wasteland = "tilesets/wasteland/neutral/buildings/oil_patch.png",
297  swamp = "tilesets/swamp/neutral/buildings/oil_patch.png"}
298
299DefineUnitType("unit-oil-patch", { Name = _("Oil Patch"),
300  Image = {"size", {96, 96}},
301  Animations = "animations-building", Icon = "icon-oil-patch",
302  NeutralMinimapColor = {0, 0, 0},
303  Neutral = true,
304  Speed = 0,
305  HitPoints = 0,
306  Indestructible = 1,
307  DrawLevel = 5,
308  TileSize = {3, 3}, BoxSize = {95, 95},
309  SightRange = 0,
310  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
311  Priority = 0,
312  Type = "naval",
313  Building = true, VisibleUnderFog = true,
314  BuildingRules = { { "distance", { Distance = 3, DistanceType = ">", Type = "unit-human-shipyard"}},
315					{ "distance", { Distance = 3, DistanceType = ">", Type = "unit-human-refinery"}},
316					{ "distance", { Distance = 3, DistanceType = ">", Type = "unit-orc-shipyard"}},
317					{ "distance", { Distance = 3, DistanceType = ">", Type = "unit-orc-refinery"}}
318				  },
319  GivesResource = "oil",
320  Sounds = {
321    "selected", "oil-patch-selected",
322--    "acknowledge", "oil-patch-acknowledge",
323--    "ready", "oil-patch-ready",
324--    "help", "oil-patch-help",
325    "dead", "building destroyed"} } )
326
327DefineUnitType("unit-pile-circle", { Name = _("The Pile"),
328  Image = {"file", "neutral/buildings/circle_of_power.png", "size", {64, 64}},
329  Animations = "animations-building", Icon = "icon-circle-of-power",
330  NeutralMinimapColor = {128, 128, 0},
331  Neutral = true,
332  Speed = 0,
333  HitPoints = 0,
334  Indestructible = 1,
335  DrawLevel = 5,
336  TileSize = {3, 3}, BoxSize = {95, 95},
337  SightRange = 0,
338  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
339  Priority = 0,
340  Corpse = "unit-destroyed-2x2-place",
341  ExplodeWhenKilled = "missile-explosion",
342  Type = "land",
343  Building = true, VisibleUnderFog = true,
344  Sounds = {
345    "help", "basic human voices help 2",
346    "dead", "building destroyed"} } )
347
348DefineUnitType("unit-circle-of-power", { Name = _("Circle of Power"),
349  Image = {"file", "neutral/buildings/circle_of_power.png", "size", {64, 64}},
350  Animations = "animations-building", Icon = "icon-circle-of-power",
351  NeutralMinimapColor = {128, 128, 0},
352  Neutral = true,
353  Speed = 0,
354  HitPoints = 0,
355  Indestructible = 1,
356  DrawLevel = 5,
357  TileSize = {2, 2}, BoxSize = {63, 63},
358  SightRange = 0,
359  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
360  Priority = 0,
361  Corpse = "unit-destroyed-2x2-place",
362  ExplodeWhenKilled = "missile-explosion",
363  Type = "land",
364  Building = true, VisibleUnderFog = true,
365  Sounds = {
366    "help", "basic human voices help 2",
367    "dead", "building destroyed"} } )
368
369
370UnitTypeFiles["unit-dark-portal"] = {summer = "tilesets/summer/neutral/buildings/dark_portal.png",
371  winter = "tilesets/winter/neutral/buildings/dark_portal.png",
372  wasteland = "tilesets/wasteland/neutral/buildings/dark_portal.png",
373  swamp = "tilesets/swamp/neutral/buildings/dark_portal.png"}
374
375DefineUnitType("unit-dark-portal", { Name = _("Dark Portal"),
376  Image = {"size", {128, 128}},
377  Animations = "animations-building", Icon = "icon-dark-portal",
378  NeutralMinimapColor = {255, 255, 0},
379  Costs = {"time", 100, "gold", 3000, "wood", 3000, "oil", 1000},
380  RepairHp = 4,
381  RepairCosts = {"gold", 1, "wood", 1, "oil", 1},
382  Construction = "construction-land2",
383  Speed = 0,
384  HitPoints = 5000,
385  DrawLevel = 40,
386  Mana = {Enable = true},
387  TileSize = {4, 4}, BoxSize = {127, 127},
388  SightRange = 4,
389  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
390  Priority = 0,
391  Corpse = "unit-destroyed-4x4-place",
392  ExplodeWhenKilled = "missile-explosion",
393  Type = "land",
394  Building = true, VisibleUnderFog = true, BuilderOutside = true,
395  Teleporter = true,
396  Sounds = {
397--    "selected", "dark-portal-selected",
398--    "acknowledge", "dark-portal-acknowledge",
399--    "ready", "dark-portal-ready",
400    "help", "basic orc voices help 2",
401    "dead", "building destroyed"} } )
402
403
404UnitTypeFiles["unit-runestone"] = {summer = "neutral/buildings/runestone.png",
405  winter = "tilesets/winter/neutral/buildings/runestone.png",
406  wasteland = "neutral/buildings/runestone.png",
407  swamp = "tilesets/swamp/neutral/buildings/runestone.png"}
408
409DefineUnitType("unit-runestone", { Name = _("Runestone"),
410  Image = {"size", {64, 64}},
411  Animations = "animations-building", Icon = "icon-runestone",
412  NeutralMinimapColor = {255, 255, 0},
413  Costs = {"time", 175, "gold", 900, "wood", 500},
414  RepairHp = 4,
415  RepairCosts = {"gold", 1, "wood", 1},
416  Construction = "construction-land2",
417  Speed = 0,
418  HitPoints = 5000,
419  DrawLevel = 40,
420  Mana = {Enable = true},
421  TileSize = {2, 2}, BoxSize = {63, 63},
422  SightRange = 4,
423  Armor = 20, BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
424  Priority = 15, AnnoyComputerFactor = 35,
425  Points = 150,
426  Corpse = "unit-destroyed-2x2-place",
427  ExplodeWhenKilled = "missile-explosion",
428  Type = "land",
429  Building = true, VisibleUnderFog = true, BuilderOutside = true,
430  Sounds = {
431--    "selected", "runestone-selected",
432--    "acknowledge", "runestone-acknowledge",
433--    "ready", "runestone-ready",
434    "help", "basic orc voices help 2",
435    "dead", "building destroyed"} } )
436
437DefineUnitType("unit-human-dead-body", { Name = _("Dead Body"),
438  Image = {"file", "neutral/units/corpses.png", "size", {72, 72}},
439  Animations = "animations-human-dead-body", Icon = "icon-peasant",
440  Speed = 0,
441  HitPoints = 255,
442  DrawLevel = 30,
443  TileSize = {1, 1}, BoxSize = {31, 31},
444  SightRange = 0,
445  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
446  Priority = 0,
447  Type = "land",
448  Vanishes = true,
449  Sounds = {} } )
450
451DefineUnitType("unit-orc-dead-body", { Name = _("Dead Body"),
452  Image = {"file", "neutral/units/corpses.png", "size", {72, 72}},
453  Animations = "animations-orc-dead-body", Icon = "icon-peasant",
454  Speed = 0,
455  HitPoints = 255,
456  DrawLevel = 30,
457  TileSize = {1, 1}, BoxSize = {31, 31},
458  SightRange = 0,
459  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
460  Priority = 0,
461  Type = "land",
462  Vanishes = true,
463  Sounds = {} } )
464
465DefineUnitType("unit-dead-sea-body", { Name = _("Dead Body"),
466  Image = {"file", "neutral/units/corpses.png", "size", {72, 72}},
467  Animations = "animations-dead-sea-body", Icon = "icon-peasant",
468  Speed = 0,
469  HitPoints = 255,
470  DrawLevel = 30,
471  TileSize = {2, 2}, BoxSize = {31, 31},
472  SightRange = 0,
473  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
474  Priority = 0,
475  Type = "naval",
476  Vanishes = true,
477  Sounds = {} } )
478
479
480UnitTypeFiles["unit-destroyed-1x1-place"] = {
481  summer = "tilesets/summer/neutral/buildings/small_destroyed_site.png",
482  winter = "tilesets/winter/neutral/buildings/small_destroyed_site.png",
483  wasteland = "tilesets/wasteland/neutral/buildings/small_destroyed_site.png",
484  swamp = "tilesets/swamp/neutral/buildings/small_destroyed_site.png"}
485
486DefineUnitType("unit-destroyed-1x1-place", { Name = _("Destroyed 1x1 Place"),
487  Image = {"size", {32, 32}},
488  Animations = "animations-destroyed-place", Icon = "icon-peasant",
489  Speed = 0,
490  HitPoints = 255,
491  DrawLevel = 10,
492  TileSize = {1, 1}, BoxSize = {31, 31},
493  SightRange = 0,
494  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
495  Priority = 0,
496  Type = "land",
497  Building = true, VisibleUnderFog = true,
498  Vanishes = true,
499  Sounds = {} } )
500
501
502UnitTypeFiles["unit-destroyed-2x2-place"] = {summer = "tilesets/summer/neutral/buildings/destroyed_site.png",
503  winter = "tilesets/winter/neutral/buildings/destroyed_site.png",
504  wasteland = "tilesets/wasteland/neutral/buildings/destroyed_site.png",
505  swamp = "tilesets/swamp/neutral/buildings/destroyed_site.png"}
506
507DefineUnitType("unit-destroyed-2x2-place", { Name = _("Destroyed 2x2 Place"),
508  Image = {"size", {64, 64}},
509  Animations = "animations-destroyed-place", Icon = "icon-peasant",
510  Speed = 0,
511  HitPoints = 255,
512  DrawLevel = 10,
513  TileSize = {2, 2}, BoxSize = {63, 63},
514  SightRange = 0,
515  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
516  Priority = 0,
517  Type = "land",
518  Building = true, VisibleUnderFog = true,
519  Vanishes = true,
520  Sounds = {} } )
521
522
523UnitTypeFiles["unit-destroyed-3x3-place"] = {summer = "tilesets/summer/neutral/buildings/destroyed_site.png",
524  winter = "tilesets/winter/neutral/buildings/destroyed_site.png",
525  wasteland = "tilesets/wasteland/neutral/buildings/destroyed_site.png",
526  swamp = "tilesets/swamp/neutral/buildings/destroyed_site.png"}
527
528DefineUnitType("unit-destroyed-3x3-place", { Name = _("Destroyed 3x3 Place"),
529  Image = {"size", {64, 64}},
530  Animations = "animations-destroyed-place", Icon = "icon-peasant",
531  Speed = 0,
532  HitPoints = 255,
533  DrawLevel = 10,
534  TileSize = {3, 3}, BoxSize = {95, 95},
535  SightRange = 0,
536  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
537  Priority = 0,
538  Type = "land",
539  Building = true, VisibleUnderFog = true,
540  Vanishes = true,
541  Sounds = {} } )
542
543UnitTypeFiles["unit-destroyed-3x3-place-water"] = {summer = "tilesets/summer/neutral/buildings/destroyed_site.png",
544  winter = "tilesets/winter/neutral/buildings/destroyed_site.png",
545  wasteland = "tilesets/wasteland/neutral/buildings/destroyed_site.png",
546  swamp = "tilesets/swamp/neutral/buildings/destroyed_site.png"}
547
548DefineUnitType("unit-destroyed-3x3-place-water", { Name = _("Destroyed 3x3 Place Water"),
549  Image = {"size", {64, 64}},
550  Animations = "animations-destroyed-place-water", Icon = "icon-peasant",
551  Speed = 0,
552  HitPoints = 255,
553  DrawLevel = 10,
554  TileSize = {3, 3}, BoxSize = {95, 95},
555  SightRange = 0,
556  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
557  Priority = 0,
558  Type = "naval",
559  Building = true, VisibleUnderFog = true,
560  Vanishes = true,
561  Sounds = {} } )
562
563UnitTypeFiles["unit-destroyed-4x4-place"] = {summer = "tilesets/summer/neutral/buildings/destroyed_site.png",
564  winter = "tilesets/winter/neutral/buildings/destroyed_site.png",
565  wasteland = "tilesets/wasteland/neutral/buildings/destroyed_site.png",
566  swamp = "tilesets/swamp/neutral/buildings/destroyed_site.png"}
567
568DefineUnitType("unit-destroyed-4x4-place", { Name = _("Destroyed 4x4 Place"),
569  Image = {"size", {64, 64}},
570  Animations = "animations-destroyed-place", Icon = "icon-peasant",
571  Speed = 0,
572  HitPoints = 255,
573  DrawLevel = 10,
574  TileSize = {4, 4}, BoxSize = {127, 127},
575  SightRange = 0,
576  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
577  Priority = 0,
578  Type = "land",
579  Building = true, VisibleUnderFog = true,
580  Vanishes = true,
581  Sounds = {} } )
582
583DefineUnitType("unit-revealer", { Name = _("Dummy unit"),
584  Animations = "animations-building", Icon = "icon-holy-vision",
585  Speed = 0,
586  HitPoints = 1,
587  TileSize = {1, 1}, BoxSize = {1, 1},
588  SightRange = 12,
589  BasicDamage = 0, PiercingDamage = 0, Missile = "missile-none",
590  Priority = 0,
591  DecayRate = 1,
592  Type = "land",
593  Building = true, VisibleUnderFog = true,
594  Revealer = true,
595  DetectCloak = true,
596  Sounds = {} } )
597
598function AiExploreUnit(unit)
599  local unitstruct = UnitManager:GetSlotUnit(unit)
600  local player = unitstruct.Player
601  if (player.AiEnabled) then
602    if (player.Type == PlayerComputer or player.Type == PlayerRescueActive) then
603      -- send those balloons flying
604      local pos = {GetUnitVariable(unit, "PosX"), GetUnitVariable(unit, "PosY")}
605      OrderUnit(player.Index, unitstruct.Type.Ident, pos, {0, 0}, "explore")
606    end
607  end
608end
609
610-- Load the different races
611Load("scripts/human/units.lua")
612Load("scripts/orc/units.lua")
613
614-- Hardcoded unit-types, moved from Stratagus to games
615UnitTypeHumanWall = UnitTypeByIdent("unit-human-wall");
616UnitTypeOrcWall = UnitTypeByIdent("unit-orc-wall");
617
618DefineUnitType = OldDefineUnitType
619DefineAnimations = OldDefineAnimations
620