Everything works fine when it's all in the one file; when I cut the weapon info into another file, my unit won't attack any more.
Do I need to put something else into either file? If so, what?
gcfly.lua :
Code: Select all
local unitName = "gcfly"
local unitDef =
{
-- Internal settings
BuildPic = "gcfly.bmp",
Category = "CUBE UNIT NOTAIR ALL",
Name = "GC Fly",
ObjectName = "gcfly.s3o",
Side = "GC",
TEDClass = "TANK",
UnitName = "gcfly",
-- Unit limitations and properties
ActivateWhenBuilt = 1,
BuildTime = 1000,
Description = "Light Scout",
MaxDamage = 60,
RadarDistance = 0,
SightDistance = 500,
SoundCategory = "GC_FLY",
Upright = 1,
-- Energy and metal related
BuildCostEnergy = 20,
BuildCostMetal = 20,
-- Pathfinding and related
Acceleration = 0.2,
BrakeRate = 0.05,
movementclass = "GC2x2",
FootprintX = 2,
FootprintZ = 2,
MaxSlope = 50,
MaxVelocity = 6.0,
MaxWaterDepth = 12,
TurnRate = 1200,
-- Abilities
Builder = 0,
Reclaimable = 0,
CanAttack = 1,
CanGuard = 1,
CanMove = 1,
CanPatrol = 1,
LeaveTracks = 0,
-- Abilities new to Spring
-- Weapons and related
weapons = {
[1] = {
def = "gcspikelaser",
}
},
ExplodeAs = "GCFLYDEATH",
SelfDestructAs = "GCFLYDEATH",
SelfDestructCountdown = 5,
NoChaseCategory = "VTOL",
}
-- Weapon info cut from here
unitDef.weaponDefs = weaponDefs
return lowerkeys({ [unitName] = unitDef })
Code: Select all
local weaponDefs = {
gcspikelaser = {
weaponType = "BeamLaser",
areaOfEffect = 8,
avoidFeature = 1,
avoidFriendly = 1,
BeamTime = 0.4,
canAttackGround = 1,
collisionSize = 8,
commandFire = 0,
coreThickness = 0.25,
craterBoost = 0,
craterMult = 0,
explosionSpeed = 5,
impulseBoost = 0,
impulseFactor = 0,
intensity = 0.8,
LaserFlareSize = 7.5,
lineofsight = 1,
minIntensity = 0.9,
noSelfDamage = 1,
range = 450,
reloadtime = 1.5,
rgbcolor = "1.0 0.0 0.0",
rgbcolor2 = "1 1 1",
thickness = 5,
turret = 1,
-- texture1 = "laserfalloff",
-- texture2 = "laserend",
explosiongenerator = "custom:GCSPIKELASER_FX",
weaponVelocity = 400,
damage = {
default = 25,
},
},
}