Kane Hart Posted January 27, 2017 Share Posted January 27, 2017 So I'm a newbie and can't really code but been reading through the miningsystem.lua a lot and I think I found a bug :) From what i can tell the hud rendering has no actual math to divide it based on the range of the module so if you have Petty or Legendary you can see the asteroids up to 5km. This all vanilla btw. function onPreRenderHud() local ship = Entity() local shipPos = ship.translationf local sphere = Sphere(shipPos, 500) local nearby = {Sector():getEntitiesByLocation(sphere)} local displayed = {} -- detect all asteroids in range for _, entity in pairs(nearby) do if entity.type == EntityType.Asteroid then local resources = entity:getMineableResources() if resources ~= nil and resources > 0 then local material = entity:getMineableMaterial() if material.value <= materialLevel then local d = distance2(entity.translationf, shipPos) table.insert(displayed, {material = material, asteroid = entity, distance = d}) end end end end -- sort by distance table.sort(displayed, sort) -- display nearest x local renderer = UIRenderer() for i = 1, math.min(#displayed, amount) do local tuple = displayed[i] renderer:renderEntityTargeter(tuple.asteroid, tuple.material.color); renderer:renderEntityArrow(tuple.asteroid, 30, 10, 250, tuple.material.color, 0); end renderer:display() end Unless range has an entire different meaning? Link to comment Share on other sites More sharing options...
Kane Hart Posted January 28, 2017 Author Share Posted January 28, 2017 Going to consider this still bugged and updated to reflect new revision. 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