Jump to content

adeilt

Members
  • Posts

    10
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

adeilt's Achievements

0

Reputation

  1. Ah, thanks! Many things become clear. I can stop checking to see if UIRenderer() returns a table because it does iff onClient(). Upon reflection, I think that this also gives me the way to get at all the other arrows (although not by modding miningsystem.lua). I'll have to mull this over a bit.
  2. Well, I posted it as-is, but I'm still hoping to figure out how to make it compatible with other overriders of onPreRenderHud . Anyone got any clues for me? https://steamcommunity.com/sharedfiles/filedetails/?id=1814439132
  3. I tried overriding onPreRenderHud directly like I did in my original post and that worked fine for no reason I can determine. ???
  4. I think I've hit a dead end with trying to override the constructor for the thing that UIRenderer() returns: if type(UIRenderer) == 'table' then local UIRenderer_metatable = getmetatable(UIRenderer) local UIRenderer_metatable_call = UIRenderer_metatable.__call UIRenderer_metatable.__call = function() local renderer = UIRenderer_metatable_call() local vanilla_RenderEntityArrow = renderer.renderEntityArrow renderer.renderEntityArrow = function(self, asteroid, width, length, visibility_threshold, color) width = 5 -- default is 10 length = 60 -- default is 30 return vanilla_RenderEntityArrow(self, asteroid, width, length, visibility_threshold, color) end return renderer end else print("Why isn't UIRenderer always a table?") end This works in that the constructor gets overridden, but it doesn't work in that I can't assign to renderer.renderEntityArrow because these are true: type(UIRenderer()) ~= 'table' type(UIRenderer()) == 'userdata' UIRenderer().__avoriontype == 'UIRenderer' I'm going to have another go at overriding onPreRenderHud.
  5. if type(UIRenderer) == 'table' then print("BEFORE") print(type(UIRenderer.new)) printTable(UIRenderer) local vanilla_UIRenderer = UIRenderer UIRenderer.new = function() local renderer = vanilla_UIRenderer() vanilla_RenderEntityArrow = renderer.renderEntityArrow renderer.renderEntityArrow = function(self, asteroid, width, length, visibility_threshold, color) width = 5 -- default is 10 length = 60 -- default is 30 vanilla_RenderEntityArrow(self, asteroid, width, length, visibility_threshold, color) end print("ARROW") print(type(renderer.renderEntityArrow)) printTable(renderer) return renderer end print("AFTER") print(type(UIRenderer.new)) printTable(UIRenderer) end That still doesn't work. BEFORE and AFTER get printed and I'm definitely modifying the "new" method, but ARROW never gets printed. A friend suggested that I read about metatables, and that looks promising... for tomorrow.
  6. So this is the current attempt (still as a [color=yellow]miningsystem.lua[/color] mod): local vanilla_UIRenderer = UIRenderer function UIRenderer() local renderer = vanilla_UIRenderer() renderer.original_RenderEntityArrow = renderer.renderEntityArrow renderer.renderEntityArrow = function(self, asteroid, width, length, visibility_threshold, color) width = 5 -- default is 10 length = 60 -- default is 30 renderer.original_RenderEntityArrow(self, asteroid, width, length, visibility_threshold, color) end end Still doesn't work, and I'm out of time for tonight. I'll try again tomorrow.
  7. Yup. Definitely doing it all wrong. :) I think I've got it now.
  8. I've found: https://avorion.gamepedia.com/Writing_your_own_Mod#Modifying_Modules_and_Libraries Looks like I'll probably be more successful after I read that.
  9. I've done some more poking at this, and it looks like I might be overriding the entire miningsystem.lua file (which is not what I want to do). Perhaps I need to hook into the loot drop somewhere and modify the object after it's instantiated?
  10. I've got a couple of ideas for workshop mods, but I'm having trouble finding any traction on them. I'm new to Lua although I've had a reasonable amount of experience with Python and Javascript. First, I want to modify the mining system arrows so that they're more visually distinguishable from other arrows. However, every time I try to override the onPreRenderHud function it breaks the Mining System upgrade modules entirely (i.e. they don't function and their tooltips are empty). I copied the entire method, added a couple of `local`s to make adjustments easier, and changed exactly one line in the function: local arrowLength = 10 // default is 30 local arrowWidth = 30 // default is 10 local oldOnPreRenderHud = onPreRenderHud function onPreRenderHud() -- omitted lines were copied verbatim from the original -- this next line is the only change I made renderer:renderEntityArrow(tuple.asteroid, arrowLength, arrowWidth, 250, tuple.material.color); -- omitted lines were copied verbatim from the original end Can anyone tell me what I'm doing wrong? Is there a cleaner way to override or wrap the function so that I don't have to copy most of it verbatim? I saw docssy's mod that made similar edits to the miningsystem.lua script, but his method required replacement of the entire file. https://www.avorion.net/forum/index.php/topic,5605.msg30327.html My other idea is to move the pickup notifications elsewhere on screen. When I'm in build mode, the stats of the ship I'm currently building are frequently covered up by pickups made by other ships in our alliance fleet. Turrets are particularly irritating to edit because when I add a turret to a ship, the "removed that turret from your inventory" message covers up the section of the stats relating to turret slots. That one has given me more trouble; I suspect that the location of those notifications is not modifiable via Lua scripts. Am I wrong? If so, can anyone point me to where such a thing might be accomplished? adeilt
×
×
  • Create New...