Skip to content

Commit

Permalink
Version 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dirtyredz committed Oct 6, 2017
1 parent fe701db commit 9490eba
Show file tree
Hide file tree
Showing 13 changed files with 449 additions and 202 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
1.3.0
--Every UI now utilizes delayed server/client communication
Will help tremendously with any high ping issues.
This will also cause a 1-5 sec delay when activating Movement of the UI's
--Added PVPSector, will show if a sector has pvp damaged Enabled/Disabled.
--ScrapyardLicenses now has the option to Allow for Clicking to show the sector on the map.
--ScrapyardLicenses now has the option to show both alliance/player licenses at the same time.
--CargoNotifier now has the option to have the UI Flash
--ObjectDetector now has the option to have the UI Flash

1.2.1
-Fixed Entity Creation bug error.

1.2.0
-Added ObjectDetector
Special Thxs to dnightmare, we were apprently working on this at the same time.
Expand Down
Binary file added PVPSector.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ He and I infact started work on this together, but he beat me to it.
So I took his work and incorperated my work in to his.
Thxs again!!

## PVPSector
This UI will display when you are inside a Player Enabled/Disabled Sector.

![alt text](https://imgur.com/S4SPW7R.png)

Remember with all these UI's they can be Moved, Enabled, Disabled, or even restricted to specific situations (coding skill required)

![alt text](https://imgur.com/oy5WRlG.png)
Expand Down Expand Up @@ -86,6 +91,8 @@ I encourage all modders to adopt this file structure as default, as its likely t

## Downloads
___
https://github.com/dirtyredz/MoveUI/releases/download/1.3.0/MoveUI.v1.3.0.zip

https://github.com/dirtyredz/MoveUI/releases/download/1.2.1/MoveUI.v1.2.1.zip

https://github.com/dirtyredz/MoveUI/releases/download/1.2.0/MoveUI.v1.2.0.zip
Expand All @@ -97,6 +104,16 @@ https://github.com/dirtyredz/MoveUI/releases/download/1.0.0/MoveUI.v1.0.0.zip

## Changelog
___
1.3.0
--Every UI now utilizes delayed server/client communication
Will help tremendously with any high ping issues.
This will also cause a 1-5 sec delay when activating Movement of the UI's
--Added PVPSector, will show if a sector has pvp damaged Enabled/Disabled.
--ScrapyardLicenses now has the option to Allow for Clicking to show the sector on the map.
--ScrapyardLicenses now has the option to show both alliance/player licenses at the same time.
--CargoNotifier now has the option to have the UI Flash
--ObjectDetector now has the option to have the UI Flash

1.2.1
-Fixed Entity Creation bug error.

Expand Down
20 changes: 19 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ He and I infact started work on this together, but he beat me to it.
So I took his work and incorperated my work in to his.
Thxs again!!

[center][b][size=25pt]PVPSector[/size][/b][/center]
This UI will display when you are inside a Player Enabled/Disabled Sector.

[img]http://imgur.com/S4SPW7R.png[/img]


Remember with all these UI's they can be Moved, Enabled, Disabled, or even restricted to specific situations (coding skill required)

[img]https://imgur.com/oy5WRlG.png[/img]
Expand Down Expand Up @@ -85,10 +91,12 @@ I encourage all modders to adopt this file structure as default, as its likely t

[b][size=24pt]Downloads[/size][/b]
[hr]
[url=https://github.com/dirtyredz/MoveUI/releases/download/1.2.1/MoveUI.v1.2.1.zip]MoveUI v1.2.1[/url]
[url=https://github.com/dirtyredz/MoveUI/releases/download/1.3.0/MoveUI.v1.3.0.zip]MoveUI v1.3.0[/url]

Older Downloads
[spoiler]
[url=https://github.com/dirtyredz/MoveUI/releases/download/1.2.1/MoveUI.v1.2.1.zip]MoveUI v1.2.1[/url]

[url=https://github.com/dirtyredz/MoveUI/releases/download/1.2.0/MoveUI.v1.2.0.zip]MoveUI v1.2.0[/url]

[url=https://github.com/dirtyredz/MoveUI/releases/download/1.1.0/MoveUI.v1.1.0.zip]MoveUI v1.1.0[/url]
Expand All @@ -98,6 +106,16 @@ Older Downloads

[b][size=24pt]Changelog[/size][/b]
[hr]
1.3.0
--Every UI now utilizes delayed server/client communication
Will help tremendously with any high ping issues.
This will also cause a 1-5 sec delay when activating Movement of the UI's
--Added PVPSector, will show if a sector has pvp damaged Enabled/Disabled.
--ScrapyardLicenses now has the option to Allow for Clicking to show the sector on the map.
--ScrapyardLicenses now has the option to show both alliance/player licenses at the same time.
--CargoNotifier now has the option to have the UI Flash
--ObjectDetector now has the option to have the UI Flash

1.2.1
-Fixed Entity Creation bug error.

Expand Down
5 changes: 3 additions & 2 deletions mods/MoveUI/config/MoveUIConfig.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local MoveUIConfig = {}

MoveUIConfig.version = "[1.2.0]"
MoveUIConfig.Author = "Dirtyredz"
MoveUIConfig.version = "[1.3.0]"
MoveUIConfig.ModName = "[MoveUI]"
MoveUIConfig.HudList = {}

Expand All @@ -23,5 +23,6 @@ MoveUIConfig.AddUI("DistCore")
MoveUIConfig.AddUI("CargoNotifier", true)
MoveUIConfig.AddUI("ScrapyardLicenses", true)
MoveUIConfig.AddUI("ObjectDetector", true)
MoveUIConfig.AddUI("PVPSector", true)

return MoveUIConfig
37 changes: 19 additions & 18 deletions mods/MoveUI/scripts/lib/MoveUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,39 @@ require('mods.MoveUI.scripts.lib.serialize')

MoveUI.Serialize = serialize

function MoveUI.Enabled(player,rect,overide)
local AllowMoving = MoveUI.AllowedMoving(player)
if AllowMoving then
drawBorder(rect, ColorRGB(0.8,0.8,0.8))
function MoveUI.Enabled(rect,overide)
drawBorder(rect, ColorRGB(0.8,0.8,0.8))

local mouse = Mouse()
local Inside = false
if mouse.position.x < rect.upper.x and mouse.position.x > rect.lower.x then
if mouse.position.y < rect.upper.y and mouse.position.y > rect.lower.y then
Inside = true
end
local mouse = Mouse()
local Inside = false
if mouse.position.x < rect.upper.x and mouse.position.x > rect.lower.x then
if mouse.position.y < rect.upper.y and mouse.position.y > rect.lower.y then
Inside = true
end
end

if Inside and mouse:mousePressed(1) then
return mouse.position, true
elseif overide then
return overide, false
end
if Inside and mouse:mousePressed(1) then
return mouse.position, true
elseif overide then
return overide, false
end

return false, false
end

function MoveUI.AllowedMoving(player)
if not player then return false end

return player:getValue('MoveUI') or false
end

function MoveUI.CheckOverride(player,default,override,title)
if override then return override end

local OldOverride = Player():getValue(title..'_MUI') or 'return nil'
OldOverride = Player():getValue(title..'_MUI') or false

OldOverride = loadstring(OldOverride)()
if OldOverride then
OldOverride = loadstring(OldOverride)()
return vec2(OldOverride.x,OldOverride.y)
end

Expand All @@ -51,12 +50,14 @@ function MoveUI.GetOptions(player,title,defaults)
end

function MoveUI.SetOptions(player,title, options)
print('SetOptions')
if onServer() then
player:setValue(title..'_MUI_Opt', MoveUI.Serialize(options))
end
end

function MoveUI.AssignPlayerOverride(player,title,position)
print('AssignPlayerOverride')
if onServer() then
local NewPosition = {}
NewPosition.x = position.x
Expand Down Expand Up @@ -96,7 +97,7 @@ end
function MoveUI.AllowClick(player,rect,func)
local mouse = Mouse()
local Inside = false
local AllowMoving = player:getValue('MoveUI') or false
local AllowMoving = MoveUI.AllowedMoving(player)
if not AllowMoving then
if mouse.position.x < rect.upper.x and mouse.position.x > rect.lower.x then
if mouse.position.y < rect.upper.y and mouse.position.y > rect.lower.y then
Expand Down
64 changes: 49 additions & 15 deletions mods/MoveUI/scripts/player/CargoNotifier.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,32 @@ local DefaultOptions = {
AF = false
}
local AF_OnOff
local rect
local res
local DefaulPosition
local LoadedOptions
local player
local Cargos
local AllowMoving

function CargoNotifier.initialize(Description)
Player():registerCallback("onPreRenderHud", "onPreRenderHud")
if onClient() then
player = Player()

player:registerCallback("onPreRenderHud", "onPreRenderHud")

rect = Rect(vec2(),vec2(170,150))
res = getResolution();
--MoveUI - Dirtyredz|David McClain
DefaulPosition = vec2(res.x * 0.34,res.y * 0.07)
rect.position = MoveUI.CheckOverride(player,DefaulPosition,OverridePosition,Title)

LoadedOptions = MoveUI.GetOptions(player,Title,DefaultOptions)

local PlayerShip = player.craft
if not PlayerShip then return end
Cargos = PlayerShip:getCargos()
end
end

function CargoNotifier.buildTab(tabbedWindow)
Expand All @@ -41,6 +64,7 @@ function CargoNotifier.buildTab(tabbedWindow)

--make sure variables are local to this file only
AF_OnOff = container:createCheckBox(TextVSplit.right, "On / Off", 'onAllowFlashing')
AF_OnOff.tooltip = 'Will Flash when dangerous cargo is detected.'

--Pass the name of the function, and the checkbox
return {onAllowFlashing = AF_OnOff}
Expand All @@ -62,26 +86,25 @@ end
function CargoNotifier.onPreRenderHud()
if onClient() then

local PlayerShip = Player().craft
if not PlayerShip then return end
local Cargos = PlayerShip:getCargos()
if not Cargos then return end

local SeenIllegal = false
local SeenStolen = false
local SeenDangerous = false
local SeenSuspicious = false

local rect = Rect(vec2(),vec2(170,150))
local res = getResolution();
--MoveUI - Dirtyredz|David McClain
local DefaulPosition = vec2(res.x * 0.34,res.y * 0.07)
rect.position = MoveUI.CheckOverride(Player(),DefaulPosition,OverridePosition,Title)

OverridePosition, Moving = MoveUI.Enabled(Player(), rect, OverridePosition)
if OverridePosition and not Moving then
invokeServerFunction('setNewPosition', OverridePosition)
if OverridePosition then
rect.position = OverridePosition
end

if MoveUI.AllowedMoving(Player()) then
if AllowMoving then
OverridePosition, Moving = MoveUI.Enabled(rect, OverridePosition)
if OverridePosition and not Moving then
invokeServerFunction('setNewPosition', OverridePosition)
OverridePosition = nil
end


drawTextRect(Title, rect, 0, 0,ColorRGB(1,1,1), 10, 0, 0, 0)
return
end
Expand All @@ -90,7 +113,6 @@ function CargoNotifier.onPreRenderHud()
local HSplit = UIHorizontalMultiSplitter(rect, 10, 10, 3)

--Flashing Option
local LoadedOptions = MoveUI.GetOptions(Player(),Title,DefaultOptions)
if os.time() % 2 == 0 and LoadedOptions.AF then return end

for TradingGood,index in pairs(Cargos) do
Expand Down Expand Up @@ -118,6 +140,18 @@ function CargoNotifier.onPreRenderHud()
end
end

function CargoNotifier.updateClient(timeStep)
LoadedOptions = MoveUI.GetOptions(player,Title,DefaultOptions)
local PlayerShip = player.craft
if not PlayerShip then return end
Cargos = PlayerShip:getCargos()
AllowMoving = MoveUI.AllowedMoving(player)
end

function CargoNotifier.getUpdateInterval()
return 5
end

function CargoNotifier.setNewPosition(Position)
MoveUI.AssignPlayerOverride(Player(),Title,Position)
end
Expand Down
Loading

0 comments on commit 9490eba

Please sign in to comment.