DracoNB Posted May 22, 2018 Share Posted May 22, 2018 Features: Shows all ships in sector Filter out Civilian and/or Friendly ships Select ship by left or right clicking on the list (Warning, left mouse WILL fire weapons!) I recommend using right click. Choose faction relation level to consider "friendly" Pre-Reqs: MoveUI by Dirtyredz (v2.1.1) Server side requirements: Yes Client side requirements: Yes Install: Download the file. Unzip "ShipNotifier.lua" to your avorion/mods/MoveUI/Scripts/player folder Edit avorion/mods/MoveUI/config/MoveUIConfig.lua and add the following down with the others: MoveUIConfig.AddUI("ShipNotifier", false) Where you add it is where it will show up on the main MoveUI screen. I personally put it under "FactionNotifier" since that deals with adding sector faction info and this adds the ship details. Here is an example video of it in action: Download: https://github.com/draconb/avorion-shipnotifier/releases Download the source code and then unzip the mods folder to your steamapps\common\avorion\mods Should look like: steamapps\common\avorion\mods\MoveUI\scripts\player\ShipNotifier.lua and have a few other files from MoveUI already in that folder such as FactionNotifier.lua. If you don't, its in the wrong spot! TODO: Figure out if there is a way to cancel mouse button events so middle mouse button can be used for target selection (it selects then deselects since the mouse isn't over a target) More options? Improve contrast? Hard to see depending on the sector / lighting. I added a slight drop shadow to help Link to comment Share on other sites More sharing options...
Ditsydoo Posted June 9, 2018 Share Posted June 9, 2018 This is pretty sweet, now if only I can get the AI to target the enemy I target. Link to comment Share on other sites More sharing options...
Galovist Posted June 9, 2018 Share Posted June 9, 2018 ;D Love this mod, so much less delegating small tasks and so much more winning. Link to comment Share on other sites More sharing options...
Shrooblord Posted July 11, 2018 Share Posted July 11, 2018 Ah geebus this is good. Thank you thank you thank you! Link to comment Share on other sites More sharing options...
DracoNB Posted July 12, 2018 Author Share Posted July 12, 2018 Ah geebus this is good. Thank you thank you thank you! Glad you like it, glad its still working for the latest patch I haven't played much myself recently Link to comment Share on other sites More sharing options...
Shrooblord Posted July 12, 2018 Share Posted July 12, 2018 My friend wanted to be able to select Stations in the same way you can select ships. I basically hacked together that functionality by lazily copy-pasting what was already in-place for ships. Not super sure if it's buggy, but it seemed to work fine for us, so give it a try if that sounds interesting to you! Exact same installation instructions; see the first post. avorion-shipnotifier-1.0_withStations.zip Link to comment Share on other sites More sharing options...
Devious Posted July 12, 2018 Share Posted July 12, 2018 Awesome, nice to see others joining in on extending MoveUI :) Link to comment Share on other sites More sharing options...
Devious Posted July 12, 2018 Share Posted July 12, 2018 My friend wanted to be able to select Stations in the same way you can select ships. I basically hacked together that functionality by lazily copy-pasting what was already in-place for ships. Not super sure if it's buggy, but it seemed to work fine for us, so give it a try if that sounds interesting to you! Exact same installation instructions; see the first post. Interesting, that's one less click than using Sector Overview :) Link to comment Share on other sites More sharing options...
Shrooblord Posted July 12, 2018 Share Posted July 12, 2018 Additionally, I added alphabetical sorting to the list (by ship name) and a tiny tweak to the colours that were used to display the names. My friend and I found the deep purple very hard to read so I made it slightly more pastel. avorion-shipnotifier-1.0_withStations_alphabetically.zip Link to comment Share on other sites More sharing options...
Shrooblord Posted July 12, 2018 Share Posted July 12, 2018 One more from me. My friend wanted to know if I could add a "[!]" in front of the Stations' names for Stations that have a Bulletin active on their Bulletin Board, so you can in one glance see whether there are Bulletins available when you jump into a Sector. The result is the attached file. It includes all the previous changes, but now also overwrites the vanilla file data/scripts/entity/bulletinboard.lua. Will conflict with other mods that overwrite the same file. Drag and drop the contents into your main Avorion folder. ---- EDIT: And a bug report: the Persecutor Pirate teams that get spawned on you when you're weak in a certain part of the Galaxy are mislabelled as "Friendly Ships", even though relations with them are Abhorrent, with the "Friendly Threshold" set at 0. ---- Bug Report #2: While piloting a Faction ship, the relations displayed are those of the ships towards the PLAYER, not towards the Faction. This is confusing behaviour. avorion-shipnotifier-1.0_withStations_alphabetically_bulletins.zip Link to comment Share on other sites More sharing options...
Bix Posted July 17, 2018 Share Posted July 17, 2018 Thanks for this mod, really, this is my number one favorite ! One thing bother me thought, the alphabetic sorting, it's either on the ship.name and not useful at all (for me) or on the ship.title and then can flicker if there's two or more from the same type. Is it possible to sort by title and/then by name ? a bit like this : local sort_func = function( a,b ) return a.title.name < b.title.name end table.sort(ShipData.Ships, sort_func) But I don't think it would work, I have zero knowledge in coding. edit : OK ! I've found with some search ! local sort_func = function( a,b ) return (a.title < b.title) or (a.title == b.title and a.name < b.name) end table.sort(ShipData.Ships, sort_func) Now everything is fine :D Link to comment Share on other sites More sharing options...
Delerium76 Posted July 17, 2018 Share Posted July 17, 2018 Thanks for this mod, really, this is my number one favorite ! One thing bother me thought, the alphabetic sorting, it's either on the ship.name and not useful at all (for me) or on the ship.title and then can flicker if there's two or more from the same type. Is it possible to sort by title and/then by name ? a bit like this : local sort_func = function( a,b ) return a.title.name < b.title.name end table.sort(ShipData.Ships, sort_func) But I don't think it would work, I have zero knowledge in coding. edit : OK ! I've found with some search ! local sort_func = function( a,b ) return (a.title < b.title) or (a.title == b.title and a.name < b.name) end table.sort(ShipData.Ships, sort_func) Now everything is fine :D Looks great, but it would be nice if the stations were separated out with their own heading, like it does in the original mod with "Friendly ships" and "Civilian ships" Link to comment Share on other sites More sharing options...
DracoNB Posted July 17, 2018 Author Share Posted July 17, 2018 One more from me. My friend wanted to know if I could add a "[!]" in front of the Stations' names for Stations that have a Bulletin active on their Bulletin Board, so you can in one glance see whether there are Bulletins available when you jump into a Sector. The result is the attached file. It includes all the previous changes, but now also overwrites the vanilla file data/scripts/entity/bulletinboard.lua. Will conflict with other mods that overwrite the same file. Drag and drop the contents into your main Avorion folder. ---- EDIT: And a bug report: the Persecutor Pirate teams that get spawned on you when you're weak in a certain part of the Galaxy are mislabelled as "Friendly Ships", even though relations with them are Abhorrent, with the "Friendly Threshold" set at 0. ---- Bug Report #2: While piloting a Faction ship, the relations displayed are those of the ships towards the PLAYER, not towards the Faction. This is confusing behaviour. Hah, I was actually going to make the stations one separate since the list can already get quite big. You could basically copy/paste the code and rename to it stations everywhere so that way you can place them in two locations and enable/disable as wanted. And yeah I noticed the Player not Faction coloring which is annoying. Meant to fix it but haven't been playing recently. Link to comment Share on other sites More sharing options...
Bix Posted July 18, 2018 Share Posted July 18, 2018 Mhhh I tried your copy/paste method, but I think I broke everything ^^ -> https://pastebin.com/k494xDfx The checkboxes are working, or displayed at least, I also have no error in server console, but there's nothing displayed on the UI... Do someone have hints ? Link to comment Share on other sites More sharing options...
DracoNB Posted July 18, 2018 Author Share Posted July 18, 2018 Mhhh I tried your copy/paste method, but I think I broke everything ^^ -> https://pastebin.com/k494xDfx The checkboxes are working, or displayed at least, I also have no error in server console, but there's nothing displayed on the UI... Do someone have hints ? You'll need to rename any "ShipNotifier" to "StationNotifier" or similar :) Link to comment Share on other sites More sharing options...
Bix Posted July 24, 2018 Share Posted July 24, 2018 Is there a way to show Alliance relations instead of player relations ? local relation = playerFaction:getRelations(factionIndex) Something to change here I think ? Link to comment Share on other sites More sharing options...
Shrooblord Posted July 25, 2018 Share Posted July 25, 2018 The following code determines a player's faction, or, if they're piloting an Alliance ship, their Alliance's faction: local faction = player or player.allianceIndex You may or may not have to attach a .index to faction in order to get it to work in the line of code you posted. Not sure. Haven't tried myself. Also, could you provide a .zip with your changes when you're done? :) EDIT: Hero Member post! yay level up Link to comment Share on other sites More sharing options...
Bix Posted July 26, 2018 Share Posted July 26, 2018 As I said I have zero knowledge, what I did is to put your code just before the first local with "faction()" in it ^^: local faction = player or player.allianceIndex local playerFaction = Faction() function ShipNotifier.detect() if onClient() then invokeServerFunction('detect') return end local ships = {Sector():getEntitiesByType(EntityType.Ship)} local stations = {Sector():getEntitiesByType(EntityType.Station)} local faction = player or player.allianceIndex local playerFaction = Faction() ShipData = {} ShipData.Ships = {} for _, ship in pairs(ships) do local index = ship.index local name = ship.name local title = ship.translatedTitle local factionIndex = ship.factionIndex local civilship = ship:hasScript("civilship.lua") local relation = playerFaction:getRelations(factionIndex) local bulletin = ship:getValue("hasBulletin") if bulletin == 1 then bulletin = "[!] " else bulletin = "" end --print (tostring(name) .. " | " .. tostring(title) .. " | " .. tostring(factionIndex) .. " | " .. tostring(civilship) .. " | " .. tostring(relation)) local shipData = {index = index, name = name, title = title, factionIndex = factionIndex, civilship = civilship, relation = relation, bulletin = bulletin} table.insert(ShipData.Ships, shipData) end for _, station in pairs(stations) do local index = station.index local name = station.name local title = station.translatedTitle local factionIndex = station.factionIndex local civilship = station:hasScript("civilship.lua") local relation = playerFaction:getRelations(factionIndex) local bulletin = station:getValue("hasBulletin") if bulletin == 1 then bulletin = "[!]" else bulletin = "" end --print (tostring(name) .. " | " .. tostring(title) .. " | " .. tostring(factionIndex) .. " | " .. tostring(civilship) .. " | " .. tostring(relation)) local shipData = {index = index, name = name, title = title, factionIndex = factionIndex, civilship = civilship, relation = relation, bulletin = bulletin} table.insert(ShipData.Ships, shipData) end ShipNotifier.sync() end Link to comment Share on other sites More sharing options...
Shrooblord Posted July 26, 2018 Share Posted July 26, 2018 Ahhhhhh herp-dee-derp my bad!! This script is already executed exclusively client-side, yes? In that case, local player = Player().index is required first. This will store the actual player index into the local variable I told you to use earlier......... xD sorry ==== EDIT: NEVERMIND. Do this: function ShipNotifier.detect(playerIndex) if onClient() then invokeServerFunction('detect', playerIndex) return end local player = Player(playerIndex) (...) end ==== You'll need to retrieve the Faction similarly. For example: Faction(player.craft.factionIndex) You may be wondering why you need to use the .index to determine the actual Faction. This is because Faction is like an object of sorts, an Entity, almost, and the index is like a UUID pointing to a specific Faction. You can't execute code on an "id" alone; you need to execute it on an actual, valid "object". So you need to "cast" the UUID into a Faction "object" in order for the code to know what you're referring to. Link to comment Share on other sites More sharing options...
Bix Posted July 26, 2018 Share Posted July 26, 2018 Niiiiiice ! It seems to work almost perfectly, almost because in one sector the trading post isn't showing up in the list. I will investigate on this. Besides this one, it's fine and the list is updated as soon as the alliance craft is left/boarded ! Now I just need to modify colors a bit, I don't like the current behaviour. I'll try to mimic default target's frames colors. Link to comment Share on other sites More sharing options...
Shrooblord Posted July 26, 2018 Share Posted July 26, 2018 Now I just need to modify colors a bit, I don't like the current behaviour. I'll try to mimic default target's frames colors.Did you base your code off of my code? I did mention I modified the colours to make them more readable, as the deep purples the mod originally used were incredibly hard to read against the dark background of space. You can simply check what the original mod used if you're not happy with the colours. Link to comment Share on other sites More sharing options...
Bix Posted July 26, 2018 Share Posted July 26, 2018 Yes I did, but I'd really prefer to get the same color pattern as the vanilla. Red, orange, yellow, purple, blue, green. I know it's not the best for readability but that's faster to spot the different factions. edit : Since the most of color gradiants are between -10 000 and 10 000, I think it's not possible to do so as the code is setting colors by steps of 10 000, if I understand ^^' function GetRelationColor(relation) for _, RC in pairs(RelationColors) do local result = RC.Relation - relation --print(RC.Relation,relation,math.abs(result)) if math.abs(result) < 10000 then return RC.R, RC.G, RC.B end end end ShipNotifier.lua.xml Link to comment Share on other sites More sharing options...
Rilgar Posted July 26, 2018 Share Posted July 26, 2018 @Bix - Sounds like some great changes. Would be great if you could upload zip of your updates :) Link to comment Share on other sites More sharing options...
Bix Posted July 27, 2018 Share Posted July 27, 2018 I've uploaded the file above your post, just erase the original one with mine (remove the .xml at the end, couldn't upload a .lua file) But keep in mind I didn't changed the colors the way I wanted, I just don't know how to do so :/ I'm still investifating Link to comment Share on other sites More sharing options...
Shrooblord Posted January 3, 2019 Share Posted January 3, 2019 I've included Bix's changes, my own changes, and made the mod Beta Branch 0.20.2-compliant, so it now uses proper "callable" functionality. I have reverted the colours back to what I like though...... ;D Installation instructions are the same as on the first post of this topic. MoveUI_ShipNotifierAddOn-v1.3.zip Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now