File: shipyard.lua

package info (click to toggle)
boswars 2.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 96,652 kB
  • sloc: cpp: 57,250; python: 1,715; sh: 25; makefile: 17
file content (123 lines) | stat: -rw-r--r-- 4,764 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
--     ____                _       __               
--    / __ )____  _____   | |     / /___ ___________
--   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
--  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  ) 
-- /_____/\____/____/     |__/|__/\__,_/_/  /____/  
--                                              
--       A futuristic real-time strategy game.
--          This file is part of Bos Wars.
--
--	shipyard.lua	-	Define the ship yard
--
--	(c) Copyright 2001 - 2012 by Francois Beerten
--
--      This program is free software; you can redistribute it and/or modify
--      it under the terms of the GNU General Public License as published by
--      the Free Software Foundation; either version 2 of the License, or
--      (at your option) any later version.
--  
--      This program is distributed in the hope that it will be useful,
--      but WITHOUT ANY WARRANTY; without even the implied warranty of
--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--      GNU General Public License for more details.
--  
--      You should have received a copy of the GNU General Public License
--      along with this program; if not, write to the Free Software
--      Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
--

DefineIcon({
	Name = "icon-shipyard",
	Size = {46, 38},
	Frame = 0,
	File = GetCurrentLuaPath().."/shipyard_i.png"})

DefineConstruction("construction-shipyard", {
	Constructions = {
		{Percent = 0, File = "main", Frame = 1},
		{Percent = 10, File = "main", Frame = 2},
		{Percent = 20, File = "main", Frame = 3},
		{Percent = 30, File = "main", Frame = 4},
		{Percent = 40, File = "main", Frame = 5},
		{Percent = 50, File = "main", Frame = 6},
		{Percent = 60, File = "main", Frame = 7},
		{Percent = 70, File = "main", Frame = 8},
		{Percent = 80, File = "main", Frame = 9},
		{Percent = 90, File = "main", Frame = 10},
		{Percent = 95, File = "main", Frame = 11},
	}
    })

DefineAnimations("animations-shipyard", {
    Still = {"frame 12", "wait 5", "frame 13", "wait 5", "frame 14", "wait 5", "frame 15", 
        "wait 5", "frame 16", "wait 5", "frame 17", "wait 5" },
    Train = {"frame 18", "wait 5", "frame 19", "wait 5", "frame 20", "wait 5", "frame 21", 
        "wait 5", "frame 22", "wait 5", "frame 23", "wait 5"},
    })

MakeSound("shipyard-selected", GetCurrentLuaPath().."/shipyard.select.wav")
--MakeSound("shipyard-dead", GetCurrentLuaPath().."/shipyard.die.wav")
--MakeSound("shipyard-ready", GetCurrentLuaPath().."/shipyard.completed.wav")
--MakeSound("shipyard-help", GetCurrentLuaPath().."/shipyard.underattack.wav")

DefineUnitType("unit-shipyard", {
    Name = "Shipyard",
    Image = {"file", GetCurrentLuaPath().."/shipyard.png", "size", {256, 256}},
    Shadow = {"file", GetCurrentLuaPath().."/shipyard_s.png", "size", {256, 256}},
    Animations = "animations-shipyard",
    Icon = "icon-shipyard",
    EnergyValue = 6000,
    MagmaValue = 6000,
    RepairHp = 2,
    Construction = "construction-shipyard",
    HitPoints = 550,
    DrawLevel = 25,
    TileSize = {6, 5},
    BoxSize = {192, 160},
    SightRange = 2,
    Armor = 30,
    BasicDamage = 0,
    PiercingDamage = 0,
    Missile = "missile-none",
    Priority = 35,
    AnnoyComputerFactor = 45,
    Points = 200,
    DeathExplosion = largeExplosion,
    Type = "naval",
    BuildingRules = {
        -- Both conditions below must be satisfied.
        {
            -- The shipyard must have at least one land or coast tile
            -- under it; it cannot be built in the open sea.  This
            -- restriction exists for the map editor.  In the game,
            -- engineers wouldn't be able to reach such a building
            -- place anyway.
            "terrain", {CountLand = true, CountCoast = true, Min = 1},

            -- The shipyard must not have more than 8 land tiles under
            -- it.  (The total size is 6*5 = 30 tiles.)  This limit
            -- must be at least 5 so that an engineer with sight range
            -- 5 walking along a coast can explore the whole building
            -- site beforehand without cameras.
         "terrain", {CountLand = true, Max = 8}}},
    AllowTerrainLand = true,
    AllowTerrainCoast = true,
    Building = true,
    VisibleUnderFog = true,
    MaxEnergyUtilizationRate = 60,
    MaxMagmaUtilizationRate = 30,
    CanHarvestFrom = true,
    Sounds = {
        "selected", "shipyard-selected",
--        "dead", "shipyard-dead",
--        "ready", "shipyard-ready",
--        "help", "shipyard-help"
}
})

DefineAllow("unit-shipyard", AllowAll)

DefineButton({
    Pos = 6, Level = 2, Icon = "icon-shipyard", Action = "build",
    Value = "unit-shipyard", Hint = "BUILD ~!SHIPYARD",
    ForUnit = {"unit-engineer"}})