Jump to content

[MOD]Gyro Array Upgrade (UPDATEDV2)


Aidenholmes9

Recommended Posts

Version 2, Now the values, price and energy requeriment change with the rarity, when unequiping the upgrade now yaw,pitch and roll should be what you have before installing the upgrade.

 

package.path = package.path .. ";data/scripts/systems/?.lua"
package.path = package.path .. ";data/scripts/lib/?.lua"
include ("basesystem")
include ("utility")

-- optimization so that energy requirement doesn't have to be read every frame
FixedEnergyRequirement = true
Unique = true

function getBonuses(seed, rarity)

local thrusters = Thrusters()
local pitch = 0
local yaw = 0
local roll = 0

if rarity.value == RarityType.Petty then
	pitch = (rarity.value + 1.25)
	yaw = (rarity.value + 1.25)
	roll = (rarity.value + 1.25)
end

if rarity.value == RarityType.Common then
	pitch = (rarity.value + 0.50)
	yaw = (rarity.value + 0.50)
	roll = (rarity.value + 0.50)
end

if rarity.value == RarityType.Uncommon then
	pitch = (rarity.value - 0.25)
	yaw = (rarity.value - 0.25)
	roll = (rarity.value - 0.25)
end

if rarity.value == RarityType.Rare then
	pitch = (rarity.value - 1)
	yaw = (rarity.value - 1)
	roll = (rarity.value - 1)
end

if rarity.value == RarityType.Exceptional then
	pitch = (rarity.value - 1.75)
	yaw = (rarity.value - 1.75)
	roll = (rarity.value - 1.75)
end

if rarity.value == RarityType.Exotic then
	pitch = (rarity.value - 2.50)
	yaw = (rarity.value - 2.50)
	roll = (rarity.value - 2.50)
end

if rarity.value == RarityType.Legendary then
	pitch = (rarity.value - 3)
	yaw = (rarity.value - 3)
	roll = (rarity.value - 3)
end

    return pitch, yaw, roll
end

function onInstalled(seed, rarity, permanent)
if not permanent then return end

    local pitch, yaw, roll = getBonuses(seed, rarity)
local thrusters = Thrusters()

thrusters.basePitch = pitch + thrusters.currentPitch
thrusters.baseRoll = roll + thrusters.currentRoll
thrusters.baseYaw = yaw + thrusters.currentYaw
thrusters.fixedStats = 1
end

function onUninstalled(seed, rarity, permanent)

local pitch, yaw, roll = getBonuses(seed, rarity)
local thrusters = Thrusters()
thrusters.basePitch = thrusters.currentPitch - pitch
thrusters.baseRoll = thrusters.currentRoll - roll
thrusters.baseYaw = thrusters.currentYaw - yaw
thrusters.fixedStats = 0
end

function getName(seed, rarity)
    return "Gyro Array Upgrade"%_t
end

function getIcon(seed, rarity)
    return "data/textures/icons/gyroscope.png"
end

function getEnergy(seed, rarity, permanent)

local pitch, yaw, roll = getBonuses(seed, rarity)

return (pitch + yaw + roll * 1500000000)
end

function getPrice(seed, rarity)

local pitch, yaw, roll = getBonuses(seed, rarity)

    return (pitch + yaw + roll * 200000)
end

function getTooltipLines(seed, rarity, permanent)
    local pitch, yaw, roll = getBonuses(seed, rarity)

    local texts =
    {
        {ltext = "Pitch"%_t, rtext = "${pitch1}"%_t % {pitch1 = (pitch)}, icon = "data/textures/icons/gyroscope.png", boosted = permanent},
	{ltext = "Yaw"%_t, rtext = "${yaw1}"%_t % {yaw1 = (pitch)}, icon = "data/textures/icons/gyroscope.png", boosted = permanent},
	{ltext = "Roll"%_t, rtext = "${roll1}"%_t % {roll1 = (pitch)}, icon = "data/textures/icons/gyroscope.png", boosted = permanent}

    }

    if not permanent then
        return {}, texts
    else
        return texts, texts
    end
end

function getDescriptionLines(seed, rarity, permanent)
    return
    {
        {ltext = "", boosted = permanent},
        {ltext = "Fixed Pitch Yaw and Roll."%_t, lcolor = ColorRGB(1, 0.5, 0.5)}
    }
end

 

Here the upgrade generator:

 

add("data/scripts/systems/gyroarrayupgrade.lua", 1)

 

Here the link: https://drive.google.com/open?id=1WLoN-PUgGS5L795M1LSN0r1ICT2rgm-P

(This is the steam version of the mod...)

(I have this uploaded to steam but only friend can see it because i never spent a cent on the steam)

 

If you upload this to workshop give me some little credits please =P

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 year later...
18 hours ago, WakelessREX said:

im sorry, what exactly does this do?

 

Hmm, it’s a mod to add System Upgrade modules (similar to the Engine upgrades) that tweak the stats of your pitch, yaw, and roll.  You might be able to use the bits in the onInstalled function for what you are trying to do.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...