Jump to content

infal

Members
  • Posts

    50
  • Joined

  • Last visited

Posts posted by infal

  1. I'd probably go to shipgenerator.lua and find the ShipGenerator.createCarrier function and delete everything in that function and replace it with a call to create defender eg:

     

    function ShipGenerator.createCarrier(faction, position, fighters)
        return ShipGenerator.createDefender(faction, position)
    end

     

    That way any time the game tried to create an npc carrier, it will still create a ship but it will be a regular defender instead.

  2. Something Linux users might be familiar with but Windows users will never have heard of: grep

     

    If you're on Windows, download a utility program called GrepWin.

     

    This will let you search all files in a directory and its sub directories for a string (or reg ex).

     

    So if you're not sure how to use a particular function that you read in the Avorion documentation and you'd like to see an example, search for it in GrepWin and it will show you a list of every time it was used in the base scripts.

  3. OP updated with the new version that is compatible with mod loader. The mod will now automatically add the script to a ship whenever the player enters the ship.

  4. This is a mod I made more as a proof of concept for the mod loading system I've been tinkering with, but the mod itself is a nice addon so I thought I might release it as a general mod.

     

    Overview: The mod adds ways for the player to transport dangerous, stolen, illegal and suspicious goods without penalty from military ships.

     

    Features:

     

    New stations added randomly to regular sectors (green dots) called Infinion Corporation Outpost.

     

    At the Infinion station you can purchase a permit to transport dangerous goods (but only dangerous goods, if you get caught with stolen, illegal or suspicious cargo, you're still in trouble!)

    The permit is time limited so if you want continued impunity, then you have to keep paying - but it doesn't require a module slot.

     

    Pirates will also randomly drop Cargo Shielding modules which give you a chance to stop a military ship from scanning your cargo. If a military ship can not scan your cargo they will not see any illicit goods at all; dangerous, stolen, illegal or suspicious.

     

    Each level of module has a Shielding Factor. Each military ship has a scanning factor, based on the weight class of the ship. eg Frigates are 2, Cruisers are 3.

     

    If the Shielding factor is greater than the Scanning factor, the scan will fail automatically.

     

    If the Shielding factor is equal to or less than the scanning factor, the chance to block the scan is random - but you still have a chance

     

    An Admin UI (aka the professional touch 8)). This lets an admin (or the player in singleplayer mode) access a UI that lets you easily select a player and give them either a shielding module or a dangerous goods permit. Great for testing before you commit to adding it to your dedicated server etc

     

     

    Screenies:

     

     

    mnYyaY8.jpg

    Buying a dangerous goods transportation permit from an Infinion Corporation Outpost. A permit allows you to legally transport dangerous goods. You may still get into trouble if you are caught carrying illegal, stolen or suspicious goods.

     

    ANgQup5.jpg

    Notification that your dangerous goods transportation permit is about to expire.

     

    fDJnax6.jpg

    Notification that your dangerous goods transportation permit has expired.

     

    Mfw9qum.jpg

    Cargo shielding modules prevent military ships from scanning your cargo hold.

     

    VPz54jm.jpg

    You will get notified whenever a military ship scans your cargo and, if you have a cargo shielding module, you will get notified if the military ship was unable to scan your cargo.

     

    Ba2cy2f.jpg

    Admin UI integrated with Mod Loader Admin UI. Allows an admin to easily select a player from the list and give them a module or permit.

     

     

     

    Downloads:

     

     

    You'll need to get Mod Loader first

    Simple Mod Loader v1.2.0

     

    You'll need Infinion Mod

    Infinion Corporation v1.0.2

     

    and finally... You need the Infinion Irregular Goods Transportation Addon

    Infinion IGTA v1.0.2

     

     

     

    Version History:

    v1.0.2 25Mar2017

    - So many bug fixes...

    - Dangerous goods permit now actually works

    - Now works for military ships that spawn in, faction war etc

    - Dangerous goods permit now gives a regular warning. Default is every 5 minutes, can adjust in config.lua

    - Admin UI is now integrated with the Mod Loader Admin UI

    - Fixed typo in check for home sector (Special thanks to Devious for pointing this out)

    - Made the Cargo Shield modules very power hungry (20 something GW for legendary) but can be scaled by changing powerFactor in config.lua though they are supposed to be power intensive for balancing.

    Older versions:

     

     

    v1.0.1 16Mar2017

    - Removed some debug server broadcast messages from playerscript

    - Added timers to antismuggle to make it less annoying for the player and less demanding on server.

    -- Player ship is only scanned once in 60 seconds

    -- suspicion update function runs once every 5 seconds instead of every second

     

     

  5. That'd be great, thanks.

     

    I worked backwards a little putting this together; I had the mods mostly done and figured out what I needed a generic mod loading system to do to make those mods work. If you're able to adapt some of your own scripts, it may raise some new ideas on what needs to be included in a mod loader system.

     

    If you happen to be testing on Linux, let me know if the scandir function is okay. I had to modify it to return files or directories but have no way to test the Linux code.

  6. Okay thanks! I wanted to wait to see if it was okay to include that code before I published it.

     

    I've added links in the original post to the github projects for modloader and 3 mods that do different things showing that you can do quite a bit without needing to overwrite base files

  7. So I've been working on my version a little more.

     

    I changed the file/folder structure so that mod loader and each mod are expected to be in their own directory. Looking at GhoStalker's case of wanting to use git, it made sense to contain everything in it's own directory.

     

    I also changed it so that mods must provide a modinfo.lua as the entry point.

     

    Still have to edit the server.lua to get the whole thing working. I haven't looked at any other options for that.

  8. Thanks, that file io code works perfectly. I've integrated it to what I already had and am now loading mods without having to list them all in a file.

    Is it okay for me to keep this code in the project and release it? I've got it in a seperate file (mods/modloader/lib/scandir.lua) so can add any credit etc you or LoSboccacc would request.

     

    Some of the things you mention I have working through events; spawning entities, custom loot etc

    eg

    I have one mod that will create custom stations in certain sectors. That's pretty much all it does.

     

    Then I have another mod which will add a dialog script to the custom stations to let the player purchase a dangerous goods permit. This second mod also makes pirates drop a cargo shielding system upgrade to prevent military ships being able to scan your cargo. To make this work I have to scan for military ships and replace their antismuggle script with a custom script.

  9. I've only been scripting LUA for a week or so. I glanced briefly at LUA file system options and they seem clunky, at best.

     

    Of course I'd prefer to have mods loaded without any file editing... but as a compromise, I'd rather edit 1 line per mod in a single file than randomly hacking through or overwriting base game files, which is the current standard.

     

    Ideally, load mods from zip files in data/mods/ directory.

     

    I'm using onPlayerLogIn event from server.lua to attach a script specified by mod info file to the player and/or run an onInitialize function in the mod info file. That allows a lot of functionality because the events system is quite powerful. I don't think a mod loader needs to do "all the things", it just needs to load the mod and let the mod author have access to the events system.

     

    If zip files aren't possible then iterate through a directory for files like the mod info above and load it in.

     

    Trade goods and production recipes are a challenge. I'm not sure if there's a way to make changes to the goods table and production table. The problem is that there is no global instance.

  10. Is anyone else working on any kind of mod loader? (is the dev team working on a mod loader?!)

     

    I've been tinkering with a simple system that would require server.lua to be modified but no other files, making it easy to install.

     

    Mod loader scans subdirectories of data/scripts/mods/ for files named modinfo.lua, if it finds a file and the file returns a modinfo table, it loads the mod.

     

    The files structure I have is like

     

    [pre]

    scripts/

    modloader/

    .git/

    api/

    lib/

    modloader.lua

    readme.md

    mods/

    cargoui/

    .git/

    modinfo.lua

    interface.lua

    playerscript.lua

    config.lua

    readme.md

    infinion/

    .git/

    modinfo.lua

    playerscript.lua

    config.lua

    readme.md

    [/pre]

     

     

    Functions:

    registerAdminUIModule

     

     

    Overview: Each time I made a mod I was also making an admin ui so that it was easy to cheat in items etc for testing. Each admin ui script had to be added to the player ship by /run command, which was tedious so I decided to make a unified Mod Loader Admin UI which can just load modules and give them a UI Container object to render in to.

     

    First implemented: v1.2.0

     

    [pre]

    -- Register an Admin UI module that will be available to server admin and singleplayer

    -- @param modName The name of the mod registering the ui panel. This is the string that will display in the listbox

    -- @param script The script to add to the ship eg "data/scripts/mods/mymod/myscript.lua"

    -- @return 0 if the function call failed, 1 for success

    function registerAdminUIModule(modName, script)

    [/pre]

     

    YU0UcZm.jpg

    2LgfU56.jpg

     

     

    registerPlayerShipScript

     

     

    Overview: I found that a lot of mods I was writing needed a script to be attached to the player ship whenever they changed ships. It's really just a matter of registering for the onChangeShips callback but I was doing it often enough that it made sense to have a single function doing all the work rather than rewrite the event handling code over and over.

     

    First implemented: v1.2.0

     

    [pre]

    -- Register a script for ModLoader to add to player ships automatically any time

    -- the player enters a ship.

    -- @param script The script to add to the ship eg "data/scripts/mods/mymod/myscript.lua"

    -- @param removeOnExit [true/false] Should the script be removed from the ship when the player exits the ship?

    -- @param allowDrone [true/false] Should the script be added to the drone?

    -- @param adminOnly [true/false] Is this script only for admins?

    function registerPlayerShipScript(script, removeOnExit, allowDrone, adminOnly)

    [/pre]

     

     

    registerSystemUpgradeAsLoot

     

     

    Overview: This function makes it easy to add System Upgrade modules as loot to NPCs. This functionality is a little bit of work because you have to handle several events, onSectorEntered/Left and onEntityCreate and then there is some processing to find the right NPC. Having one single generic system to handle this made sense.

     

    First implemented: v1.2.0

     

    [pre]

    -- Registers system upgrades as loot to be added to NPCs

    --

    -- @param script The filename for the system upgrade eg "data/scripts/mods/mymods/myupgrade.lua"

    -- @param npc The type of NPC you want. Look in modloader/lib/enums.lua for values eg NPC.Xsotan

    -- @param class The class of ship. eg ShipClass.Cruiser  or  ShipClass.Any etc

    -- @param chance [1-100] The chance of this loot being added to an NPC

    -- @return An integer id for the loot table incase you need to remove it at a certain point mid-session

    function registerSystemUpgradeAsLoot(script, npc, class, distribution, chance)

    [/pre]

     

     

     

     

    Links:

    Simple Mod Loader on GitHub -or- Zip file Download

    The basic mod loader. I haven't included a modified server.lua file or instructions on what code to add etc as part of the git but they are in the zip file for download

     

    Mod Template on GitHub -or- Zip file Download

    Some files to help get a mod started.

     

    Cargo UI mod on GitHub -or- Forum Topic

    This mod shows how to have a script attach to the player's ship.

     

    Infinion Corporation mod on Github -or- Forum Topic

    This mod shows how to generate a custom station in random sectors and how to make the station easily accessible to other mods.

    Infinion Irregular Goods Transportation Addon mod on Github

    This mod shows how to add a script to the custom station above, add loot to pirates when the player enters a sector and how to change behaviour of military ships by removing a default script and adding a custom script in it's place.

     

    Infinion Corporation Faction Modules -or- Forum Topic

    This mod adds 3 system upgrade modules that are mostly just base game turret control systems but with boosted stats. It shows how to add them as loot drops to NPCs, very selectively, and how to make a module for the unified Admin UI.

  11. There is a stat bonus for acceleration but I have no idea if that acceleration applies to thrusters, or only engines.

     

    You can check if a ship has thrusters with Entity():hasComponent(ComponentType.Thruster)

     

    The volumetric thruster system in the beta branch is a lot better than the surface area system in the stable branch, you can have large blocks of thrusters and also directional thrusters hidden inside the ship without having to do the 'wafers trick' to increase surface area.

  12. Great mod, I love it for my single player game. The only issue I have is that I can't rightly roll this out on my dedicated server because a good number of the players aren't that tech literate and I'd rather avoid needed to tell everyone that they need to do an immersion-killing run command for each ship to get it working. Is there a way that I can modify the base files so that individuals can avoid using the run command? Thanks!

    ok habs geschaft clientseitiger Mod. Problem müßte ich "/run) für alle freigeben und das kann gefährlich sein

     

    gibt das auch serverseitig?

    Thanks for the feedback guys. I only speak English but what I'm gathering from Andy's post is that the /run command doesn't work client side on a dedicated server. I only play (and test) in a single player world.

     

    I'm working on some code that will allow it to run by adding a line or two to server.lua, and will have an update soontm

  13. If you click in the Empty space below your List,  myListBox.selected will return -1 and trigger the crash.

    I'm doing a wild guess and say you didn't sanitize such an input?

     

    Perfect! That was exactly the problem. Thank you! I've updated the first post with a new download and removed the pic with the crash warning.

  14. Hey, this is a great mod, I wondered tho, where would I have to change base files so it runs the script on every ship i enter?

     

    It's possible, but not as easy as just adding a line in a file somewhere. You'd probably go to server.lua and register a player onShipChanged handler and then in the handler you'd add or remove the script to the ship.

     

     

    I don't have any problems with my Listbox:

     

    Interesting. Do you use the beta branch?

    I'll look back through the code to see if I'm doing anything wrong. I've only been scripting with lua for 2 or 3 days  ;D

     

     

    thank you for making this!

     

    No probs! I hope you like it!

  15. Looks very good :D

    Definitly using this

    Thanks!

     

    I just added some info about uninstalling to the first post. It seems like the game will delete your ship if it can't find a script so you have to removeScript before deleting the actual file.

  16. I'm getting the rep loss, even with the updated antismuggle file. I had -100,000 rep, sold them an asteroid and got +15,000 then I got the message 3 times in quick succession while they were also shooting at me...

     

    Can you please change it so that if I have the module fitted it just does a player:sendMessage "Your cargo has been scanned. [Faction name] thank you for having the correct permit" instead of a full dialog

    Screenshots:

     

    XHpedCV.jpg

    Uivsa52.jpg

    b3ZqVao.jpg

     

     

  17. I decided to make a small mod that would let you see the full list of items in your ship's cargo hold.

     

    It highlights any irregular items with coloured text so they stand out in the list.

     

    Screenshots:

     

    p2wd66B.jpg

    Stolen and illegal items are red, suspicious is dark yellow, dangerous is yellow. Also, this screen shows the list partly scrolled.

     

    (Suspicious sheep... when are sheep not suspicious though...?)

     

    i8Tyg7A.jpg

    The mod adds an icon to the top right screen

     

    AurK80x.jpg

    My actual game, not cheating items in. Mostly the items are white with the irregular items being a different colour to stand out.

     

    Z1mt0T5.jpg

    Here I've abandoned the mission from the player menu and then dumped the cargo with the cargo ui.

     

     

     

    Downloads:

     

     

    You need to have Mod Loader v1.2.0+

    Mod Loader Forum Topic

     

    Then you need Cargo UI:

    Cargo UI v1.3.2

     

    Instructions for installing each, should be in the zip files.

     

     

     

    Updates

     

     

    v1.3.2 25mar2017

    - Mostly just updated to make it work with Mod Loader 1.2.0+ but the way it works is a little more efficient now.

    v1.3.1 15Mar2017

    - Made this mod work with mod loader to resolve issues where players on servers couldn't use the script because they couldn't access the /run command

    v1.01 03Mar2017

    - Laserzwei provided feedback and suggestion on a crash that occurred when the empty space in the listbox was clicked. Rookie error, fixed with generous help. Thanks Laserzwei!

     

     

  18. I'm trying to get a label to update it's value dynamically when the selected item in a listbox is changed. It updates the first time but not after that.

     

    I've used printlog to see that the selected index is in fact changing each time I click a different item in the listbox, but the label only updates once.

     

    Any UI gurus able to tell me what I'm doing wrong?

     

    function initUI()
        ... usual window init and registration stuff
    
        myLabel = window:createlabel(vec2(10, 10), "", 20)
    end
    
    function updateUI()
        ... check if selected index has changed
    
        --selected index has changed so update text label
        myLabel.caption = "Some string derived from the selected index"
    end
    

     

     

    EDIT: Never mind, I figured it out. The update was working correctly. I was getting the listbox entry incorrectly, so it was defaulting to 0  ???  ::)

  19. I'm sure it's been discussed... but I couldn't find a relevant thread here in the suggestions section.

     

    Can we have resources as a cargo item. StarMade actually has a good approach to inventory. The player entity has an inventory of a finite size. Once salvage turrets [mining laser] fill the player inventory, any further resources must go to ship cargo.

     

    If the player entity in Avorion has an inventory of, say 5000, they could manage which resources and other items - turrets, upgrades etc - were absolutely necessary and keep those in personal inventory. If their ship is destroyed, they have enough resources to get a basic ship going.

     

    I think this would improve immersion, if you want to build a huge capital ship you have to acquire resources and have enough cargo space to haul those resources - which makes you vulnerable to attack- so you need to either harden your hauler or have combat capable escorts.

×
×
  • Create New...