Skip to content

Commit 576ab0c

Browse files
Adding Notify to GitHub
1 parent f3acc6a commit 576ab0c

File tree

11 files changed

+1078
-0
lines changed

11 files changed

+1078
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Notify
2+
======
3+
4+
SupCom mod that notifies teammates when RAS is done
5+
6+
To toggle Nofity's messages to chat, enter /enableNotifyChat or /disableNotifyChat into the chat
7+
To toggle Notify's ETA world overlay, enter /enableNotifyOverlay or /disableNotifyOverlay into the chat
8+
To toggle both of the above, enter /enableNotify or /disableNotify into the chat
9+
10+
To only toggle for the current game, and not save back to preferences, you can add "once" to the end of the previous commands (e.g., "/disableNotifyChat once")
11+
12+
Install the mod in mods/Notify i.e:
13+
14+
%USERPROFILE%\Documents\My Games\Gas Powered Games\Supreme Commander Forged Alliance\mods\

hook/lua/ui/game/chat.lua

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
local modPath = '/mods/Notify/'
2+
3+
local runCommand = import(modPath .. 'modules/commands.lua').runCommand
4+
5+
local oldCreateChatEdit = import('/lua/ui/game/chat.lua').CreateChatEdit
6+
local oldOnEnterPressed
7+
8+
function CreateChatEdit()
9+
local group = oldCreateChatEdit()
10+
11+
oldOnEnterPressed= group.edit.OnEnterPressed
12+
13+
group.edit.OnEnterPressed = function(self, text)
14+
if(string.len(text) > 1 and string.sub(text, 1, 1) == "/") then
15+
local args = {}
16+
17+
for w in string.gfind(string.sub(text, 2), "%S+") do
18+
table.insert(args, w)
19+
end
20+
21+
if(runCommand(args)) then
22+
return
23+
end
24+
end
25+
26+
return oldOnEnterPressed(self, text)
27+
end
28+
29+
return group
30+
end

hook/lua/ui/game/commandmode.lua

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
local oldOnCommandIssued = OnCommandIssued
2+
local ignoreSelection = false
3+
4+
function SetIgnoreSelection(ignore)
5+
ignoreSelection = ignore
6+
end
7+
8+
function OnCommandIssued(command)
9+
local checkBadClean = import('/lua/ui/game/construction.lua').checkBadClean
10+
if(command.Clear == true and command.CommandType ~= 'Stop' and table.getn(command.Units) == 1 and checkBadClean(command.Units[1])) then
11+
import('/lua/ui/game/construction.lua').watchForQueueChange(command.Units[1])
12+
end
13+
14+
if(command.CommandType == 'Script' and command.LuaParams and command.LuaParams.Enhancement) then
15+
import('/mods/Notify/modules/notify.lua').enqueueEnhancement(command.Units, command.LuaParams.Enhancement)
16+
elseif(command.CommandType == 'Stop') then
17+
import('/mods/Notify/modules/notify.lua').clearEnhancements(command.Units)
18+
end
19+
20+
oldOnCommandIssued(command)
21+
end
22+
23+
local oldEndCommandMode = EndCommandMode
24+
function EndCommandMode(isCancel)
25+
if ignoreSelection == false then
26+
oldEndCommandMode(isCancel)
27+
end
28+
end

0 commit comments

Comments
 (0)