Author Topic: [MOD] Easier Turret Factory  (Read 2706 times)

bobisback

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    8
    • View Profile
on: January 25, 2018, 11:09:00 PM
Easier Turret Factory
This mod makes some simple QoL changes to how the turret factory functions to allow the user to build turrets in an easier way. This mod does two primary things, first it allows the user to hold ctrl, shift, or alt, while hitting the plus and minus buttons on the turret factory to give +5, +10, +50 respectively. This mod also only refreshes the UI when you build a new turret instead of resetting all the values for everything. So once you have the turret you want, you can just keep clicking build until there are no more resources left.

The changes are pretty simple, but unfortunately will not work unless loaded on the server and the client.

Installation instructions
- Download the mod from the bottom of this post.
- Extract the contents to your root Avorion folder. Aka: "\Steam\steamapps\common\Avorion"
- Assuming the file structure stayed in tact it should ask to overwrite turretfactory.lua, just click yes to replace the file.

How to use
Once installed all turret factories will now have the ability to change different amounts by holding down ctrl, shift, or alt and clicking the plus or minus. Also when you build the turret it will not reset any values.

Files changed

Overwritten
Avorion\data\scripts\entity\merchants\turretfactory.lua

Known Issues
If you hold more then one down at a time you can get weirdness. Don't really care tbh lol

Inside the technical changes
The biggest change was changing the line in the buildTurret function that looks like
this: invokeClientFunction(player, "onShowWindow")
to this: invokeClientFunction(player, "refreshUI").

I also added in some code to handle the key presses.

Credits
_OMAR_ For turret fix code
Rinaldo (Rinart73) For code help
Dirtyredz For code help

Edit: Removed turret values fix.

« Last Edit: February 02, 2018, 08:56:02 PM by bobisback »



TheGoodDoctor

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    1
    • View Profile
on: January 30, 2018, 11:16:11 PM
Great mod! Thank you :D:D

Clicking x40 times per turret build was maddening... my flag ship has 60 weapons to build each time I wanted to upgrade -_-

I spliced back in the original broken weapon stat calculation that gives higher damage / range for lower ingredients because... well... I think it's fun to break the game! If anyone reading this wants to do the same you simply copy line 66 to line 226 from your original turretfactory.lau and paste it over the same lines in Bobisback's turretfactory.lau.

Thanks again for your work.



Shrooblord

  • Hero Member
  • *****
  • Status:
    Offline
    Posts:
    589
    • View Profile
on: January 30, 2018, 11:25:17 PM
TheGoodDoctor, thank you for posting instructions on how to modify the file. Do you think you could post a diff using DiffChecker, though? That way, also users in the future will be able to make the modifications you propose, as line numbers alone are subject to change during the process of development.
Shrooblord



bobisback

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    8
    • View Profile
on: January 30, 2018, 11:36:46 PM
Honestly probably going to revert those changes anyway. I only put them in on a request and so far I am not to happy with them. Nor do I truly understand the code behind it, me being a programmer by trade that breaks a major rule of mine.



bobisback

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    8
    • View Profile
on: February 02, 2018, 08:57:37 PM
I have re-uploaded without the turret value fixes. If you would like to read up on these changes and reincorporate them please see this thread and merge the files: http://www.avorion.net/forum/index.php/topic,4362.msg23191.html

Here is a better implementation of this mod that is client side only, going to see if he wants to incorporate my hotkey changes and we can merge them: https://www.avorion.net/forum/index.php/topic,4421.0.html
« Last Edit: February 02, 2018, 09:00:10 PM by bobisback »