4
data/scripts/lib/galaxy.lua
Normal file
4
data/scripts/lib/galaxy.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
weaponProbabilities[WeaponType.AutoCannon] = {d = 0.65, p = 2.0}
|
||||
weaponProbabilities[WeaponType.HeavyCannon] = {d = 0.6, p = 1.0}
|
||||
weaponProbabilities[WeaponType.Diffuser] = {d = 0.6, p = 1.0}
|
||||
4
data/scripts/lib/inventoryitemprice.lua
Normal file
4
data/scripts/lib/inventoryitemprice.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
valueWeights[WeaponType.AutoCannon ] = 2
|
||||
valueWeights[WeaponType.HeavyCannon ] = 1.7
|
||||
valueWeights[WeaponType.Diffuser ] = 2.1
|
||||
177
data/scripts/lib/turretgenerator.lua
Normal file
177
data/scripts/lib/turretgenerator.lua
Normal file
@@ -0,0 +1,177 @@
|
||||
|
||||
scales[WeaponType.AutoCannon] = {
|
||||
{from = 0, to = 28, size = 1.5, usedSlots = 2},
|
||||
{from = 29, to = 38, size = 2.0, usedSlots = 3},
|
||||
{from = 39, to = 49, size = 3.0, usedSlots = 4},
|
||||
--dummy for cooaxial, add 1 to size and level
|
||||
{from = 50, to = 52, size = 3.5, usedSlots = 5},
|
||||
}
|
||||
|
||||
scales[WeaponType.HeavyCannon] = {
|
||||
{from = 0, to = 28, size = 3.0, usedSlots = 4},
|
||||
{from = 29, to = 38, size = 4.0, usedSlots = 5},
|
||||
{from = 39, to = 49, size = 5.0, usedSlots = 6},
|
||||
--dummy for cooaxial, add 1 to size and level
|
||||
{from = 50, to = 52, size = 5.5, usedSlots = 6},
|
||||
}
|
||||
|
||||
scales[WeaponType.Diffuser] = {
|
||||
{from = 0, to = 46, size = 1.0, usedSlots = 2},
|
||||
{from = 47, to = 50, size = 2.0, usedSlots = 4},
|
||||
--dummy for cooaxial, add 1 to size and level
|
||||
{from = 51, to = 52, size = 3.0, usedSlots = 6},
|
||||
}
|
||||
|
||||
if GameVersion() >= Version(0, 31, 0) then
|
||||
possibleSpecialties[WeaponType.AutoCannon] = {
|
||||
{specialty = Specialty.HighDamage, probability = 0.2},
|
||||
{specialty = Specialty.HighRange, probability = 0.3},
|
||||
{specialty = Specialty.HighRange, probability = 0.35},
|
||||
{specialty = Specialty.HighFireRate, probability = 0.5},
|
||||
}
|
||||
else
|
||||
possibleSpecialties[WeaponType.AutoCannon] = {
|
||||
Specialty.HighDamage,
|
||||
Specialty.HighFireRate,
|
||||
Specialty.HighRange,
|
||||
Specialty.HighHullDamage,
|
||||
Specialty.HighShieldDamage,
|
||||
Specialty.LessCoolingTime,
|
||||
Specialty.BurstFire,
|
||||
}
|
||||
end
|
||||
|
||||
if GameVersion() >= Version(0, 31, 0) then
|
||||
possibleSpecialties[WeaponType.HeavyCannon] = {
|
||||
{specialty = Specialty.HighDamage, probability = 0.2},
|
||||
{specialty = Specialty.HighRange, probability = 0.35},
|
||||
{specialty = Specialty.HighFireRate, probability = 0.5},
|
||||
{specialty = Specialty.BurstFire, probability = 0.2},
|
||||
}
|
||||
else
|
||||
possibleSpecialties[WeaponType.HeavyCannon] = {
|
||||
Specialty.HighDamage,
|
||||
Specialty.HighFireRate,
|
||||
Specialty.HighRange,
|
||||
Specialty.HighHullDamage,
|
||||
Specialty.HighShieldDamage,
|
||||
Specialty.LessCoolingTime,
|
||||
Specialty.BurstFire,
|
||||
}
|
||||
end
|
||||
|
||||
if GameVersion() >= Version(0, 31, 0) then
|
||||
possibleSpecialties[WeaponType.Diffuser] = {
|
||||
{specialty = Specialty.HighDamage, probability = 0.2},
|
||||
{specialty = Specialty.HighRange, probability = 0.3},
|
||||
{specialty = Specialty.HighRange, probability = 0.35},
|
||||
{specialty = Specialty.HighFireRate, probability = 0.5},
|
||||
}
|
||||
else
|
||||
possibleSpecialties[WeaponType.Diffuser] = {
|
||||
Specialty.HighDamage,
|
||||
Specialty.HighRange,
|
||||
Specialty.SlightlyHigherHullDamage,
|
||||
Specialty.FasterRechargeTime,
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
function TurretGenerator.generateAutoCannonTurret(rand, dps, tech, material, rarity)
|
||||
local result = TurretTemplate()
|
||||
|
||||
-- generate turret
|
||||
local requiredCrew = TurretGenerator.dpsToRequiredCrew(dps)
|
||||
local crew = Crew()
|
||||
crew:add(requiredCrew, CrewMan(CrewProfessionType.Gunner))
|
||||
result.crew = crew
|
||||
|
||||
-- generate weapons
|
||||
local numWeapons = rand:getInt(1, 4)
|
||||
|
||||
local weapon = WeaponGenerator.generateAutoCannon(rand, dps, tech, material, rarity)
|
||||
weapon.fireDelay = weapon.fireDelay * numWeapons
|
||||
|
||||
-- attach weapons to turret
|
||||
TurretGenerator.attachWeapons(rand, result, weapon, numWeapons)
|
||||
|
||||
local shootingTime = 25 * rand:getFloat(0.8, 1.2)
|
||||
local coolingTime = 15 * rand:getFloat(0.8, 1.2)
|
||||
TurretGenerator.createStandardCooling(result, coolingTime, shootingTime)
|
||||
|
||||
TurretGenerator.scale(rand, result, WeaponType.AutoCannon, tech, 0.6)
|
||||
TurretGenerator.addSpecialties(rand, result, WeaponType.AutoCannon)
|
||||
|
||||
result:updateStaticStats()
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
generatorFunction[WeaponType.AutoCannon] = TurretGenerator.generateAutoCannonTurret
|
||||
|
||||
|
||||
function TurretGenerator.generateHeavyCannonTurret(rand, dps, tech, material, rarity)
|
||||
local result = TurretTemplate()
|
||||
|
||||
-- generate turret
|
||||
local requiredCrew = TurretGenerator.dpsToRequiredCrew(dps)
|
||||
local crew = Crew()
|
||||
crew:add(requiredCrew, CrewMan(CrewProfessionType.Gunner))
|
||||
result.crew = crew
|
||||
|
||||
-- generate weapons
|
||||
local numWeapons = rand:getInt(1, 4)
|
||||
|
||||
local weapon = WeaponGenerator.generateHeavyCannon(rand, dps, tech, material, rarity)
|
||||
weapon.fireDelay = weapon.fireDelay * numWeapons
|
||||
|
||||
-- attach weapons to turret
|
||||
TurretGenerator.attachWeapons(rand, result, weapon, numWeapons)
|
||||
|
||||
local shootingTime = 25 * rand:getFloat(0.8, 1.2)
|
||||
local coolingTime = 20 * rand:getFloat(0.8, 1.2)
|
||||
TurretGenerator.createStandardCooling(result, coolingTime, shootingTime)
|
||||
|
||||
TurretGenerator.scale(rand, result, WeaponType.HeavyCannon, tech, 0.6)
|
||||
TurretGenerator.addSpecialties(rand, result, WeaponType.HeavyCannon)
|
||||
|
||||
result:updateStaticStats()
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
generatorFunction[WeaponType.HeavyCannon] = TurretGenerator.generateHeavyCannonTurret
|
||||
|
||||
|
||||
function TurretGenerator.generateDiffuserTurret(rand, dps, tech, material, rarity)
|
||||
local result = TurretTemplate()
|
||||
|
||||
-- generate turret
|
||||
local requiredCrew = TurretGenerator.dpsToRequiredCrew(dps)
|
||||
local crew = Crew()
|
||||
crew:add(requiredCrew, CrewMan(CrewProfessionType.Gunner))
|
||||
result.crew = crew
|
||||
|
||||
-- generate weapons
|
||||
local numWeapons = rand:getInt(1, 2)
|
||||
|
||||
local weapon = WeaponGenerator.generateDiffuser(rand, dps, tech, material, rarity)
|
||||
weapon.damage = weapon.damage / numWeapons
|
||||
|
||||
-- attach weapons to turret
|
||||
TurretGenerator.attachWeapons(rand, result, weapon, numWeapons)
|
||||
|
||||
local rechargeTime = 20 * rand:getFloat(0.8, 1.2)
|
||||
local shootingTime = 15 * rand:getFloat(0.8, 1.2)
|
||||
TurretGenerator.createBatteryChargeCooling(result, rechargeTime, shootingTime)
|
||||
|
||||
|
||||
TurretGenerator.scale(rand, result, WeaponType.Diffuser, tech, 0.75)
|
||||
TurretGenerator.addSpecialties(rand, result, WeaponType.Diffuser)
|
||||
|
||||
result:updateStaticStats()
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
generatorFunction[WeaponType.Diffuser] = TurretGenerator.generateDiffuserTurret
|
||||
34
data/scripts/lib/turretingredients.lua
Normal file
34
data/scripts/lib/turretingredients.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
TurretIngredients[WeaponType.AutoCannon] =
|
||||
{
|
||||
{name = "Servo", amount = 15, investable = 10, minimum = 5, weaponStat = "fireRate", investFactor = 1.0, changeType = StatChanges.Percentage},
|
||||
{name = "Warhead", amount = 5, investable = 6, minimum = 1, weaponStat = "damage", },
|
||||
{name = "High Pressure Tube", amount = 2, investable = 6, minimum = 1, weaponStat = "reach", },
|
||||
{name = "Ammunition M", amount = 2, investable = 4, minimum = 1, weaponStat = "damage", investFactor = 0.5,},
|
||||
{name = "Targeting Card", amount = 3, investable = 3, minimum = 0, weaponStat = "seeker", investFactor = 1, changeType = StatChanges.Flat},
|
||||
{name = "Steel", amount = 8, investable = 10, minimum = 3,},
|
||||
{name = "Steel Tube", amount = 5, investable = 10, minimum = 3,},
|
||||
-- {name = "Targeting System", amount = 0, investable = 2, minimum = 0, turretStat = "automatic", investFactor = 1, changeType = StatChanges.Flat},
|
||||
}
|
||||
|
||||
TurretIngredients[WeaponType.HeavyCannon] =
|
||||
{
|
||||
{name = "Servo", amount = 8, investable = 8, minimum = 4, weaponStat = "fireRate", investFactor = 1.0, changeType = StatChanges.Percentage},
|
||||
{name = "Warhead", amount = 5, investable = 6, minimum = 1, weaponStat = "damage", },
|
||||
{name = "High Pressure Tube", amount = 2, investable = 6, minimum = 1, weaponStat = "reach", },
|
||||
{name = "Ammunition", amount = 5, investable = 10, minimum = 3, weaponStat = "damage", investFactor = 0.2,},
|
||||
{name = "Steel", amount = 20, investable = 10, minimum = 20,},
|
||||
{name = "Metal Plate", amount = 8, investable = 10, minimum = 10,},
|
||||
-- {name = "Targeting System", amount = 0, investable = 2, minimum = 0, turretStat = "automatic", investFactor = 1, changeType = StatChanges.Flat},
|
||||
}
|
||||
|
||||
TurretIngredients[WeaponType.Diffuser] =
|
||||
{
|
||||
{name = "Plasma Cell", amount = 10, investable = 10, minimum = 10, weaponStat = "fireRate", investFactor = 1.0, changeType = StatChanges.Percentage},
|
||||
{name = "High Capacity Lens", amount = 5, investable = 6, minimum = 1, weaponStat = "reach", },
|
||||
{name = "Energy Tube", amount = 2, investable = 6, minimum = 1, weaponStat = "damage", },
|
||||
{name = "Steel", amount = 20, investable = 0, minimum = 20,},
|
||||
{name = "Copper", amount = 10, investable = 0, minimum = 10,},
|
||||
{name = "Silver", amount = 5, investable = 0, minimum = 5,},
|
||||
-- {name = "Targeting System", amount = 0, investable = 2, minimum = 0, turretStat = "automatic", investFactor = 1, changeType = StatChanges.Flat},
|
||||
}
|
||||
139
data/scripts/lib/weapongenerator.lua
Normal file
139
data/scripts/lib/weapongenerator.lua
Normal file
@@ -0,0 +1,139 @@
|
||||
|
||||
function WeaponGenerator.generateAutoCannon(rand, dps, tech, material, rarity)
|
||||
local weapon = Weapon()
|
||||
weapon:setProjectile()
|
||||
|
||||
dps = dps * 0.75
|
||||
local fireDelay = rand:getFloat(1.5, 2.5)*0.5
|
||||
local reach = rand:getFloat(1100, 1500)*0.7
|
||||
local damage = dps * fireDelay
|
||||
local speed = rand:getFloat(300, 400)*1.5
|
||||
local existingTime = (reach / speed)*1.1
|
||||
|
||||
weapon.fireDelay = fireDelay
|
||||
weapon.reach = reach
|
||||
weapon.appearanceSeed = rand:getInt()
|
||||
weapon.seeker = rand:test(1 / 2)
|
||||
weapon.appearance = WeaponAppearance.Cannon
|
||||
weapon.name = "Auto Cannon /* Weapon Name*/"%_t
|
||||
weapon.prefix = "Auto Cannon /* Weapon Prefix*/"%_t
|
||||
weapon.icon = "data/textures/icons/autocannon.png"
|
||||
weapon.sound = "cannon"
|
||||
weapon.accuracy = 0.99 - rand:getFloat(0, 0.03)
|
||||
|
||||
weapon.damage = damage
|
||||
weapon.damageType = DamageType.Physical
|
||||
weapon.impactParticles = ImpactParticles.Explosion
|
||||
weapon.shieldDamageMultiplicator=1.1 + rarity.value * 0.1
|
||||
weapon.impactSound = 1
|
||||
weapon.impactExplosion = true
|
||||
|
||||
weapon.psize = rand:getFloat(0.2, 0.5)
|
||||
weapon.pmaximumTime = existingTime
|
||||
weapon.pvelocity = speed
|
||||
weapon.pcolor = ColorHSV(rand:getFloat(10, 60), 0.7, 1)
|
||||
|
||||
WeaponGenerator.adaptWeapon(rand, weapon, tech, material, rarity)
|
||||
|
||||
-- these have to be assigned after the weapon was adjusted since the damage might be changed
|
||||
weapon.recoil = weapon.damage * 20 * 0.75
|
||||
weapon.explosionRadius = math.sqrt(weapon.damage * 6)
|
||||
|
||||
return weapon
|
||||
end
|
||||
|
||||
generatorFunction[WeaponType.AutoCannon] = WeaponGenerator.generateAutoCannon
|
||||
|
||||
|
||||
function WeaponGenerator.generateHeavyCannon(rand, dps, tech, material, rarity)
|
||||
local weapon = Weapon()
|
||||
weapon:setProjectile()
|
||||
|
||||
dps = dps * 1.85
|
||||
local fireDelay = rand:getFloat(1.5, 2.5)*1.8
|
||||
local reach = rand:getFloat(1100, 1500)*0.5
|
||||
local damage = dps * fireDelay
|
||||
local speed = rand:getFloat(600, 1000)
|
||||
local existingTime = (reach / speed)*1.1
|
||||
|
||||
weapon.fireDelay = fireDelay
|
||||
weapon.reach = reach
|
||||
weapon.appearanceSeed = rand:getInt()
|
||||
weapon.appearance = WeaponAppearance.Bolter
|
||||
weapon.name = "Heavy Cannon /* Weapon Name*/"%_t
|
||||
weapon.prefix = "Heavy Cannon /* Weapon Prefix*/"%_t
|
||||
weapon.icon = "data/textures/icons/heavycannon.png"
|
||||
weapon.sound = "cannon"
|
||||
weapon.accuracy = 0.89 - rand:getFloat(0, 0.03)
|
||||
|
||||
weapon.damage = damage
|
||||
weapon.damageType = DamageType.Physical
|
||||
weapon.impactParticles = ImpactParticles.Explosion
|
||||
weapon.impactSound = 1
|
||||
weapon.impactExplosion = true
|
||||
weapon.otherForce = dps*math.max(1, rarity.value)*89*5
|
||||
|
||||
weapon.psize = rand:getFloat(0.2, 0.5)
|
||||
weapon.pmaximumTime = existingTime
|
||||
weapon.pvelocity = speed
|
||||
weapon.pcolor = ColorHSV(rand:getFloat(10, 60), 0.7, 1)
|
||||
|
||||
WeaponGenerator.adaptWeapon(rand, weapon, tech, material, rarity)
|
||||
|
||||
-- these have to be assigned after the weapon was adjusted since the damage might be changed
|
||||
weapon.recoil = weapon.damage * 50
|
||||
weapon.explosionRadius = math.sqrt(weapon.damage * 7)
|
||||
|
||||
return weapon
|
||||
end
|
||||
|
||||
generatorFunction[WeaponType.HeavyCannon] = WeaponGenerator.generateHeavyCannon
|
||||
|
||||
|
||||
function WeaponGenerator.generateDiffuser(rand, dps, tech, material, rarity)
|
||||
local weapon = Weapon()
|
||||
weapon:setBeam()
|
||||
|
||||
local fireDelay = rand:getFloat(1, 2.5)*1.5
|
||||
local reach = rand:getFloat(950, 1400)
|
||||
local damage = dps * fireDelay
|
||||
|
||||
weapon.fireDelay = fireDelay
|
||||
weapon.appearanceSeed = rand:getInt()
|
||||
weapon.reach = reach
|
||||
weapon.continuousBeam = false
|
||||
weapon.appearance = WeaponAppearance.Tesla
|
||||
weapon.name = "Diffuser /* Weapon Name*/"%_t
|
||||
weapon.prefix = "Diffuser /* Weapon Prefix*/"%_t
|
||||
weapon.icon = "data/textures/icons/diffuser.png"
|
||||
weapon.sound = "railgun"
|
||||
weapon.accuracy = 0.99 - rand:getFloat(0, 0.02)
|
||||
|
||||
weapon.damage = damage
|
||||
weapon.damageType = DamageType.Energy
|
||||
weapon.impactParticles = ImpactParticles.Energy
|
||||
weapon.shieldDamageMultiplicator = 20 + rand:getFloat(0, 4) + rarity.value * 3
|
||||
weapon.stoneDamageMultiplicator = 0
|
||||
weapon.hullDamageMultiplicator = 0
|
||||
weapon.impactSound = 1
|
||||
|
||||
weapon.blength = weapon.reach
|
||||
weapon.bshape = BeamShape.Lightning
|
||||
weapon.bwidth = 0.5
|
||||
weapon.bauraWidth = 3
|
||||
weapon.banimationSpeed = 0
|
||||
weapon.banimationAcceleration = 0
|
||||
weapon.bshapeSize = 13
|
||||
|
||||
-- shades of blue
|
||||
weapon.bouterColor = ColorHSV(rand:getFloat(180, 260), rand:getFloat(0.5, 1), rand:getFloat(0.1, 0.5))
|
||||
weapon.binnerColor = ColorHSV(rand:getFloat(180, 260), rand:getFloat(0.1, 0.5), 1)
|
||||
|
||||
WeaponGenerator.adaptWeapon(rand, weapon, tech, material, rarity)
|
||||
|
||||
weapon.recoil = weapon.damage * 5
|
||||
|
||||
return weapon
|
||||
end
|
||||
|
||||
generatorFunction[WeaponType.Diffuser] = WeaponGenerator.generateDiffuser
|
||||
4
data/scripts/lib/weapontype.lua
Normal file
4
data/scripts/lib/weapontype.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
WeaponTypes.addType("AutoCannon", "Auto Сannon /* Weapon Type */"%_t, armed)
|
||||
WeaponTypes.addType("HeavyCannon", "Heavy Cannon /* Weapon Type */"%_t, armed)
|
||||
WeaponTypes.addType("Diffuser", "Diffuser /* Weapon Type */"%_t, armed)
|
||||
34
data/scripts/player/ui/encyclopedia/chapters/wpeturrets.lua
Normal file
34
data/scripts/player/ui/encyclopedia/chapters/wpeturrets.lua
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
Categories = Categories or {}
|
||||
category = {}
|
||||
|
||||
table.insert(Categories, category)
|
||||
|
||||
category.title = "WPE Turrets"%_t
|
||||
category.chapters =
|
||||
{
|
||||
{
|
||||
title = "Intro"%_t,
|
||||
picture = "data/textures/slide/thumb.png",
|
||||
text = "In this part of the encyclopedia you will find a description of the turrets from the Weapon Pack Extended mod.\n\nI recommend using turret models from the collection in the workshop."%_t,
|
||||
},
|
||||
|
||||
{
|
||||
title = "Autocannon"%_t,
|
||||
picture = "data/textures/slide/3.png",
|
||||
text = "A lightweight version of the classic cannon.\n\nCompared to conventional cannons:\n+ Increased rate of fire (x2)\n+ Increased projectile speed (x1.5)\n+ A little more damage on the shield (10% - 15%)\n+ Can be equipped with homing missiles.\n- Less damage (x0.75)\n- Shorter damage range (x0.8)"%_t,
|
||||
},
|
||||
|
||||
{
|
||||
title = "Heavy Cannon"%_t,
|
||||
picture = "data/textures/slide/4.png",
|
||||
text = "The cannon of the main caliber. It shoots with heavy explosive shells, the hit of which can displace the enemy ship.\n\n+ High damage\n+ High projectile speed\n+ When hit, push the opponent\n- Low rate of fire\n- Occupies many slots\n- Big size"%_t,
|
||||
},
|
||||
|
||||
{
|
||||
title = "Energy diffuser"%_t,
|
||||
picture = "data/textures/slide/1.png",
|
||||
text = "Short range combat weapon. Does not cause damage to the hull, but extremely effectively destroys shields. Requires civil slots.\n\nShield Damage x20"%_t,
|
||||
},
|
||||
|
||||
}
|
||||
1
data/scripts/player/ui/encyclopedia/contents.lua
Normal file
1
data/scripts/player/ui/encyclopedia/contents.lua
Normal file
@@ -0,0 +1 @@
|
||||
contents = {}
|
||||
17
data/scripts/player/ui/encyclopedia/encyclopedia.lua
Normal file
17
data/scripts/player/ui/encyclopedia/encyclopedia.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
Encyclopedia._fillTree = Encyclopedia.fillTree
|
||||
|
||||
function Encyclopedia.fillTree()
|
||||
|
||||
include("chapters/wpeturrets")
|
||||
|
||||
Encyclopedia._fillTree()
|
||||
|
||||
local searchText = string.trim(self.searchTextBox.text)
|
||||
|
||||
if searchText == "" then
|
||||
Encyclopedia.fillTreeCompletely()
|
||||
else
|
||||
Encyclopedia.fillTreeFiltered(searchText)
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user