| 1 |
-- ____ _ __ |
| 2 |
-- / __ )____ _____ | | / /___ ___________ |
| 3 |
-- / __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/ |
| 4 |
-- / /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ ) |
| 5 |
-- /_____/\____/____/ |__/|__/\__,_/_/ /____/ |
| 6 |
-- |
| 7 |
-- A futuristic real-time strategy game. |
| 8 |
-- This file is part of Bos Wars. |
| 9 |
-- |
| 10 |
-- shipyard.lua - Define the ship yard |
| 11 |
-- |
| 12 |
-- (c) Copyright 2001 - 2012 by Francois Beerten |
| 13 |
-- |
| 14 |
-- This program is free software; you can redistribute it and/or modify |
| 15 |
-- it under the terms of the GNU General Public License as published by |
| 16 |
-- the Free Software Foundation; either version 2 of the License, or |
| 17 |
-- (at your option) any later version. |
| 18 |
-- |
| 19 |
-- This program is distributed in the hope that it will be useful, |
| 20 |
-- but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
-- GNU General Public License for more details. |
| 23 |
-- |
| 24 |
-- You should have received a copy of the GNU General Public License |
| 25 |
-- along with this program; if not, write to the Free Software |
| 26 |
-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 27 |
-- |
| 28 |
|
| 29 |
DefineIcon({ |
| 30 |
Name = "icon-shipyard", |
| 31 |
Size = {46, 38}, |
| 32 |
Frame = 0, |
| 33 |
File = GetCurrentLuaPath().."/shipyard_i.png"}) |
| 34 |
|
| 35 |
DefineConstruction("construction-shipyard", { |
| 36 |
Constructions = { |
| 37 |
{Percent = 0, File = "main", Frame = 1}, |
| 38 |
{Percent = 10, File = "main", Frame = 2}, |
| 39 |
{Percent = 20, File = "main", Frame = 3}, |
| 40 |
{Percent = 30, File = "main", Frame = 4}, |
| 41 |
{Percent = 40, File = "main", Frame = 5}, |
| 42 |
{Percent = 50, File = "main", Frame = 6}, |
| 43 |
{Percent = 60, File = "main", Frame = 7}, |
| 44 |
{Percent = 70, File = "main", Frame = 8}, |
| 45 |
{Percent = 80, File = "main", Frame = 9}, |
| 46 |
{Percent = 90, File = "main", Frame = 10}, |
| 47 |
{Percent = 95, File = "main", Frame = 11}, |
| 48 |
} |
| 49 |
}) |
| 50 |
|
| 51 |
DefineAnimations("animations-shipyard", { |
| 52 |
Still = {"frame 12", "wait 5", "frame 13", "wait 5", "frame 14", "wait 5", "frame 15", |
| 53 |
"wait 5", "frame 16", "wait 5", "frame 17", "wait 5" }, |
| 54 |
Train = {"frame 18", "wait 5", "frame 19", "wait 5", "frame 20", "wait 5", "frame 21", |
| 55 |
"wait 5", "frame 22", "wait 5", "frame 23", "wait 5"}, |
| 56 |
}) |
| 57 |
|
| 58 |
MakeSound("shipyard-selected", GetCurrentLuaPath().."/shipyard.select.wav") |
| 59 |
--MakeSound("shipyard-dead", GetCurrentLuaPath().."/shipyard.die.wav") |
| 60 |
--MakeSound("shipyard-ready", GetCurrentLuaPath().."/shipyard.completed.wav") |
| 61 |
--MakeSound("shipyard-help", GetCurrentLuaPath().."/shipyard.underattack.wav") |
| 62 |
|
| 63 |
DefineUnitType("unit-shipyard", { |
| 64 |
Name = "Shipyard", |
| 65 |
Image = {"file", GetCurrentLuaPath().."/shipyard.png", "size", {256, 256}}, |
| 66 |
Shadow = {"file", GetCurrentLuaPath().."/shipyard_s.png", "size", {256, 256}}, |
| 67 |
Animations = "animations-shipyard", |
| 68 |
Icon = "icon-shipyard", |
| 69 |
EnergyValue = 6000, |
| 70 |
MagmaValue = 6000, |
| 71 |
RepairHp = 2, |
| 72 |
Construction = "construction-shipyard", |
| 73 |
HitPoints = 550, |
| 74 |
DrawLevel = 25, |
| 75 |
TileSize = {6, 5}, |
| 76 |
BoxSize = {192, 160}, |
| 77 |
SightRange = 2, |
| 78 |
Armor = 30, |
| 79 |
BasicDamage = 0, |
| 80 |
PiercingDamage = 0, |
| 81 |
Missile = "missile-none", |
| 82 |
Priority = 35, |
| 83 |
AnnoyComputerFactor = 45, |
| 84 |
Points = 200, |
| 85 |
DeathExplosion = largeExplosion, |
| 86 |
Type = "naval", |
| 87 |
BuildingRules = { |
| 88 |
-- Both conditions below must be satisfied. |
| 89 |
{ |
| 90 |
-- The shipyard must have at least one land or coast tile |
| 91 |
-- under it; it cannot be built in the open sea. This |
| 92 |
-- restriction exists for the map editor. In the game, |
| 93 |
-- engineers wouldn't be able to reach such a building |
| 94 |
-- place anyway. |
| 95 |
"terrain", {CountLand = true, CountCoast = true, Min = 1}, |
| 96 |
|
| 97 |
-- The shipyard must not have more than 8 land tiles under |
| 98 |
-- it. (The total size is 6*5 = 30 tiles.) This limit |
| 99 |
-- must be at least 5 so that an engineer with sight range |
| 100 |
-- 5 walking along a coast can explore the whole building |
| 101 |
-- site beforehand without cameras. |
| 102 |
"terrain", {CountLand = true, Max = 8}}}, |
| 103 |
AllowTerrainLand = true, |
| 104 |
AllowTerrainCoast = true, |
| 105 |
Building = true, |
| 106 |
VisibleUnderFog = true, |
| 107 |
MaxEnergyUtilizationRate = 60, |
| 108 |
MaxMagmaUtilizationRate = 30, |
| 109 |
CanHarvestFrom = true, |
| 110 |
Sounds = { |
| 111 |
"selected", "shipyard-selected", |
| 112 |
-- "dead", "shipyard-dead", |
| 113 |
-- "ready", "shipyard-ready", |
| 114 |
-- "help", "shipyard-help" |
| 115 |
} |
| 116 |
}) |
| 117 |
|
| 118 |
DefineAllow("unit-shipyard", AllowAll) |
| 119 |
|
| 120 |
DefineButton({ |
| 121 |
Pos = 6, Level = 2, Icon = "icon-shipyard", Action = "build", |
| 122 |
Value = "unit-shipyard", Hint = "BUILD ~!SHIPYARD", |
| 123 |
ForUnit = {"unit-engineer"}}) |