Jump to content

Rinart73

Members
  • Posts

    416
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by Rinart73

  1. Well, in theory this could work:

    callback onDamaged(objectIndex, amount, inflictor, damageType) - fires before the damage is dealt

     

    But this callback:

    callback onBlockDamaged(objectIndex, blockIndex, inflictorId, damage, damageType) - fires after damage is dealt, but before block is destroyed.

     

    So you can try to heal the ship immediately after taking damage. It may produce an error, because i'm not sure what is "blockIndex" in this context. It may be an index of the block or type index.

    function MyModNamespace.initialize()
        Entity():registerCallback("onBlockDamaged", "onBlockDamaged")
    end
    
    function MyModNamespace.onBlockDamaged(objectIndex, blockIndex, inflictorId, damage, damageType)
        local entity = Entity(objectIndex)
        entity:heal(damage, blockIndex, vec3(), entity.factionIndex) 
    end
    

  2. Hi.

     

    You can use this to turn entity invincible. Shield still can be damaged, but durability will not. You can use this in the "update" function when some conditions are met. And you will need to turn it off (false) once you're done.

    Entity():invincible = true

     

    Avorion doesn't have the feature that allows to cancel an event.

  3. 1.1.0

    • Fixed: Vanilla exploit that allowed to build turrets with any (but usually 0) amount of ingredients
    • Added: Now when research process of player-made turrets produces a turret, mod will ensure that this turret will follow the same rules as a player-made turret (so people couldn't research several player-made turrets into something that costs billions).
      The resulting turret "ingredientPrice" will be the sum of researched player-made turrets "ingredientPrice"-s.
      And "assemblyPrice" will consist of researched player-made turrets "assemblyPrice"-s + other turrets/upgrades prices.

     

    Also, if you're using Extended Turret Factory version 0.1.1, here is the patch for it. Future versions of that mod should already include this patch.

    You still need to install both Extended Turret Factory and this mod.

    ExtTurretFactory-0.1.1_turretExploitPatch.zip

  4. Update: Version 0.23 - bug is still there

     

    Version: 0.17.1 (maybe even older) - 0.18.3

     

    Turret Factory script doesn't check ingredient amount that was passed by the client. This allows to build turrets with any ingredient amount (0 = you will only pay credits, 1000 = super-powerful turret).

     

    How to reproduce

    [*]"data\scripts\entity\merchants\turretfactory.lua" - Lines 69 to 238  change amount to 0 on client-side

    [*]Try to build a turret

     

    How to fix

    "data\scripts\entity\merchants\turretfactory.lua" - Line 859:

    
    
    -- Replace this: ingredient.amount = other.amount
    -- With this:
    ingredient.amount = math.min(ingredient.amount + ingredient.investable, math.max(ingredient.minimum, other.amount))

  5. Now when I'm using this function every frame, ship seems to rotate correctly, but there is no way to stop it. So it reaches correct direction, script stops calling "setToFlyToLocation", but ship (as in the first message) continues to rotate with increasing speed.

    I tried all of these, nothing can stop ship from rotating:

    ship:setToFlyToLocation(ship.translationf)
    ShipAI():setIdle()
    ShipAI():setPassive()
    Velocity():setAngularVelocity(ship.look, 0)
    

     

    local abs = math.abs
    
    local isRotating = false
    
    function MyMod.getUpdateInterval()
        if not isRotating  then return 1 end
    end
    
    function MyMod.updateServer(timeStep)
        local ship = Entity()
        local target = myFunctionGetTarget() -- I checked, it's an entity
    
        -- I need ship to face target, so I check difference between where ship looks and where it needs to look
        local look = ship.look
        local lookOther = normalize(target.translationf - ship.translationf)
        local difference = lookOther - look
        difference = abs(difference.x) + abs(difference.y) + abs(difference.z)
    
        if difference > 0.5 then
            ship:setToFlyToLocation(target.translationf)
            ship.desiredVelocity = 0
            isRotating = true
        elseif isRotating then
            isRotating = false
        end
    end
    

  6. local abs = math.abs
    
    local isRotating = false
    
    function MyMod.getUpdateInterval()
        return 1
    end
    
    function MyMod.updateServer(timeStep)
        local ship = Entity()
        local target = myFunctionGetTarget() -- I checked, it's an entity
    
        -- I need ship to face target, so I check difference between where ship looks and where it needs to look
        local look = ship.look
        local lookOther = normalize(target.translationf - ship.translationf)
        local difference = lookOther - look
        difference = abs(difference.x) + abs(difference.y) + abs(difference.z)
    
        if difference > 0.5 and not isRotating then
            ship:setToFlyToLocation(target.translationf)
            ship.desiredVelocity = 0
            isRotating = true
        elseif isRotating then
            isRotating = false
        end
    end
    

     

    As you see from the code above, I call "setToFlyToLocation" function only once. I thought that the ship will just rotate in place and when it will face target entity I will start to do next part of code.

  7. 0.17-0.18.3

     

    I register an entity (asteroid for example) as enemy:

    local ai = ShipAI()
    ai:registerEnemyEntity(target.index)
    ai:setPassiveShooting(true)

     

    Ship starts to attack it (not always , another bug?)

    Then I'm trying to unregister it or register it as a friend:

    local ai = ShipAI()
    -- any of the following
    ai:unregisterEnemyEntity(target.index)
    ai:registerFriendEntity(target.index)
    

    Ship in passive fire mode doesn't care and continues to fire.

  8. It would be cool to have an API that would allow to attack an entity without moving the ship.

    Currently I'm trying to use:

    local ai = ShipAI()
    ai:registerEnemyEntity(target.index)
    ai:setPassiveShooting(true)
    

    But it doesn't work well and in theory ship may switch targets automatically if it will find another enemy ship nearby.

  9. Starting from game version 0.23 mod is moved to the Steam Workshop.

     

    0.17.1-0.18.3

     

    I use Energy Suppressor Satellites a lot to hide my mining ships from persecutors. And it's very confusing when they burn out but still look the same. Just a bunch of green icons in the sector.

    So, I decided to fix this and add few useful things.

     

    Features

    • When suppressors burn out they turn into wreckages
    • If you'll enable this feature in suppressor settings, it will send you (or your Alliance) a mail when a satellite will burn out. In case of Alliance, only members with "Manage Ships" privilege will receive a message.
    • Fixes bug that spawns Ogonite/Xanion suppressor when it' used by an Alliance faction
    • You can  use "/burnsuppressors" command to turn suppressors, that burnt out before mod installation, into wreckages

     

    Installation

    • Unpack mod archive into "Avorion" folder
    • Add following line in the end of the file "data\scripts\entity\energysuppressor.lua":

    if not pcall(require, 'mods.ImprovedEnergySuppressor.scripts.entity.energysuppressor') then print('[ERROR][improvedEnergySuppressor]: failed to extend entity/energysuppressor.lua!') end

    • Add this line in the end of the file "data\scripts\items\energysuppressor.lua":

    if not pcall(require, 'mods.ImprovedEnergySuppressor.scripts.items.energysuppressor') then print('[ERROR][improvedEnergySuppressor]: failed to extend items/energysuppressor.lua!') end

     

    Uninstallation

     

    • Remove the lines that you added during the installation
    • Delete "ImprovedEnergySuppressor" folder from the "mods" folder

     

     

    Compatibility

     

     

    Mod overrides following functions:

    data\scripts\entity\energysuppressor.lua

    • EnergySuppressor.updateServer
    • EnergySuppressor.interactionPossible

    data\scripts\items\energysuppressor.lua

    • activate

     

    Mod extends following functions:

    data\scripts\entity\energysuppressor.lua

    • EnergySuppressor.initialize
    • EnergySuppressor.initUI
    • EnergySuppressor.onSync
    • EnergySuppressor.secure
    • EnergySuppressor.restore

     

     

     

    Changelog

     

     

    1.0.1

    • Fixed: Energy suppressors time didn't decrease. At all.
    • Fixed: A bug that erased suppressor time after installing the mod. Ouch.

    1.0.0

    • Initial release

     

     

    Help to Translate

    Currently supported languages: English, Russian. You can help to translate this mod:

     

     

    • "Automatic Notification" - mail header
    • "Send a mail when suppressor will burn out" - energy suppressor settings

     

    ImprovedEnergySuppressor-1.0.0_0.17.1-0.18.2.zip

    ImprovedEnergySuppressor-1.0.1_0.17.1-0.18.3.zip

  10. Since devs are saying that the next update will be about system upgrades, I decided to remind about two old and annoying bugs related to the upgrades. Both of these bugs are present on all recent Avorion versions.

     

    [*]You can perfectly fine install/uninstall upgrades via right click, but when a player drags them into/out of the slot, game sometimes fails to attach/unattach script. This will result in "Object Detectors" not highlighting asteroids, no "Trading module" icon e.t.c. Or you can drag out the "Trading module" upgrade and still have it's icon (and thus the attached script).

    [*]Occasionally UI 'hides' installed upgrades icons so their slots look like no upgrade is installed. Can't find a way to reproduce it though.

  11. Starting from game version 0.23 mod is moved to the Steam Workshop.

     

    Currently the biggest problem in the Avorion economy balance is the exploit that allows to construct turrets that cost billions and trillions. I'm totally not against the idea of making turrets for profit, but this profit should be reasonable.

    And while devs are working on the global balance (which is a hard work), I came up with a local solution of this problem.

     

    This mod allows the game to 'remember' a cost of all ingredients of a player-made turret and assembly price, so selling price will be based on that instead of vanilla price. It will only affect turrets that were created after this mod was installed.

     

    Should be compatible with 0.17.1-0.18.3.

     

    By default mod has settings that result in non-profitable turrets that cost 25% of their production price at maximum. If you want to adjust settings, look at "Configuration" section.

     

    Installation

    • Unpack mod archive into "Avorion" folder
    • Add following line in the end of the file "data/scripts/entity/merchants/equipmentdock.lua":

    if not pcall(require, "mods.TurretSellingFix.scripts.entity.merchants.equipmentdock") then print("[ERROR][TurretSellingFix]: Failed to extend equipmentdock.lua!") end

    • Add this line in the end of the file "data/scripts/entity/merchants/turretfactory.lua":

    if not pcall(require, "mods.TurretSellingFix.scripts.entity.merchants.turretfactory") then print("[ERROR][TurretSellingFix]: Failed to extend turretfactory.lua!") end

    • And this line in the end of the file "data/scripts/entity/merchants/researchstation.lua":

    if not pcall(require, "mods.TurretSellingFix.scripts.entity.merchants.researchstation") then print("[ERROR][TurretSellingFix]: Failed to extend researchstation.lua!") end

     

    Uninstallation

     

    • Remove the lines that you added during the installation
    • Delete "TurretSellingFix" folder from the "mods" folder

     

     

    Known issues

     

    • (Minor UI) Empty line will appear in the turret descriptions. There is no way to hide it or fixate it's position

     

     

    Compatibility (2, new info as of 16.09.18)

     

     

    • Extended Turret Factory - should be compatible if Turret Selling Fix will be installed after it.
      If you're using version 0.1.1, you'll need to install a patch from this post.
    • Auto Research - should be compatible if Turret Selling Fix will be installed after it.

     

    Incompatible with any mod that allows to change turrets after they were built (Weapon Engineering for example). Please message me if you're dev of the mod.

     

    Mod overrides following functions:

    data/scripts/entity/merchants/turretfactory.lua

    • buildTurret

    data/scripts/entity/merchants/equipmentdock.lua

    • EquipmentDock.shop:updateBuyGui
    • EquipmentDock.shop:updateBuybackGui
    • EquipmentDock.shop:buyFromPlayer
    • EquipmentDock.shop:buyTrashFromPlayer
    • EquipmentDock.shop:sellBackToPlayer

    data/scripts/entity/merchants/researchstation.lua

    • transform

     

    Mod extends following functions:

    data/scripts/entity/merchants/turretfactory.lua

    • makeTurret

    data/scripts/entity/merchants/equipmentdock.lua

    • EquipmentDock.initialize - client only

     

     

     

    Configuration

     

     

    Ingredient price is how much all plasma cells and steel tubes that were used to create a turret cost.

    Assembly price is additional credit cost that players pay when they build a turret.

    Production price = (Ingredient price + Assembly price)

    mod Selling Price = (Ingredient price * ingredientPriceMultiplier) + (Assembly price * assemblyPriceMultiplier)

    Profit is possible if the resulting Selling price is greater than Production price.

     

    File "mods/TurretSellingFix/config/TurretSellingFix.lua" has a few parameters that will let you adjust how the mod works:

    • config.useMinimalValue = true/false — Determines which price mod will use.
      If true, mod will choose minimal value between (Vanilla price * 0.25) and Selling price
      If false, mod Selling price will always be used
    • config.ingredientPriceMultiplier = float (0.25, 1.02..) — A multiplier for Ingredient price.
      Multiplier 0.25  will result in a vanilla-like behavior - it will be completely non-profitable to make money via turrets.
      Multiplier 1.0+  will allow people to make money with turrets (it also depends on assemblyPriceMultiplier)
    • config.assemblyPriceMultiplier = float (0.25, 1.02..) — A multiplier for Assembly price.
      Multiplier 0.25  will result in a vanilla-like behavior - it will be completely non-profitable to make money via turrets.
      Multiplier 1.0+  will allow people to make money with turrets (it also depends on ingredientPriceMultiplier)
    • config.maxProfit = -1/number — Allows to limit maximal profit that player can get from selling a turret.
      Example:
      Ingredient price = 500 000, Assembly price = 200 000 => Production price = 700 000
      ingredientPriceMultiplier = 1.4, assemblyPriceMultiplier = 1.3; maxProfit is 100 000
      Selling price will be 100 000 instead of 260 000
      -1  means no limit

     

     

    Changelog

     

     

    1.1.1

    • Fixed: Vanilla exploit that allowed to build high-rarity turrets (thanks to Hammelpilaw)

    1.1.0

    • Fixed: Vanilla exploit that allowed to build turrets with any (but usually 0) amount of ingredients
    • Added: Now when research of player-made turrets produces a turret, mod will ensure that this turret is following the same rules as a player-made turret.
      The resulting turret "ingredientPrice" will be the sum of researched player-made turrets "ingredientPrice"-s.
      And "assemblyPrice" will consist of researched player-made turrets "assemblyPrice"-s + other turrets/upgrades prices.

    1.0.1

    • Fixed: It appears that players always have to pay credits to build a turret - so now the resulting Selling price is based on Ingredient Price and Assembly price (credit cost)
    • Added: 'assemblyPriceMultiplier' config option
    • Changed: Renamed config parameter 'priceMultiplier' to 'ingredientPriceMultiplier'

    1.0.0

    • Initial release

     

     

    Credits

    • Devious - for reporting component amount 0 exploit
    • Hammelpilaw - for reporting high-rarity exploit

    TurretSellingFix-1.0.0_0.17.1-0.18.2.zip

    TurretSellingFix-1.0.1_0.17.1-0.18.2.zip

    TurretSellingFix-1.1.0_0.17.1-0.18.3.zip

    TurretSellingFix-1.1.1_0.17.1-0.18.3.zip

  12. 1. function Matrix rotate(Matrix in, float angle, vec3 axis) - rotates orientation Matrix around the axis by angle specified in radians. The rotation should be performed on server side and it's instant.

    local entity = Entity()
    entity.orientation = rotate(entity.orientation, 1.57, vec3(1, 0, 0))

     

    2. Gradually rotating entity using following function:

    function addRotation(vec3 axis, float angularVelocity) - will add angular velocity and the entity will still rotate around the axis. But you'll need to apply it every update and stop when it will be enough.

    Also, you need to use this function on both client and server I think.

    function MyNamespace.update()
        Velocity():addRotation(vec3(1, 0, 0), 2)
    end
    

  13. 1.1.0

    • Added: Now mod resets AIAction and order icon before the jump and when a player enters the ship
    • Added: Config file

     

    This update is important because some mods (Complex Craft Orders for example) had problems with processing orders after players entered ship or ships jumping into other sector - now you can set up consecutive Jump Orders and they will work!

    Also, now mod IS NOT client-side only.

  14. Sandworm, nice work.

     

    But I guess you should add following styles to the 'navbar' class, because otherwise "Top"/"Goto"/"Clear" buttons can't be clicked and filter input field is not visible:

    position: relative;
    z-index: 1;

     

    And maybe some changes in the 'quicknav' class, so it would not be under other elements:

    top: 128px;
    z-index: 2;

  15. Hi Exspes, thanks for posting.

    This ruleset should do the trick.

     

    hint.jpg

     

    The thing is: currently if ship jumped into another sector, it will NOT jump again unless any other action was made. I'm working on this issue. Other than that, everything should work fine after the jump

×
×
  • Create New...