Jump to content

infal

Members
  • Posts

    50
  • Joined

  • Last visited

Everything 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. All client and server. To be fair I haven't tried to test them as client side only or server side only. I just assumed that mods should be client and server.
  3. If you want math.random() to return the same value each time for any module, you need to set the seed. function getNumTurrets(seed, rarity) math.randomseed(seed) local someRand = math.random()
  4. 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.
  5. infal

    [Mod] Cargo UI

    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.
  6. 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: Screenies: Downloads: 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:
  7. 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.
  8. 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
  9. 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.
  10. 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.
  11. 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.
  12. 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 Functions: registerAdminUIModule registerPlayerShipScript registerSystemUpgradeAsLoot 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.
  13. 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.
  14. infal

    [Mod] Cargo UI

    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
  15. infal

    [Mod] Cargo UI

    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.
  16. infal

    [Mod] Cargo UI

    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. 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 No probs! I hope you like it!
  17. infal

    [Mod] Cargo UI

    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.
  18. 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:
  19. infal

    [Mod] Cargo UI

    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: Downloads: Updates
  20. 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 ??? ::)
  21. When in build mode and HUD is hidden (default F8 key) can we please have the giant green arrows also hidden? It'd make that 'perfect' shot look nicer.
  22. I started a thread in the Suggestions section of the forum about resources as cargo - https://www.avorion.net/forum/index.php/topic,1787.0.html - Add your support to the suggestion if you think it would be a good addition to the game ;D
  23. 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.
  24. I assumed jump calc time was the 'curtain' hiding level loading. If you had zero jump calc time for example, would you just have a long loading screen?
×
×
  • Create New...