Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function widget:GetInfo()
- return {
- name = "repeat repeat orders",
- desc = "a way to keep track of multiple sets of repeat orders and cycling through them",
- author = "zombean",
- date = "2024",
- license = "GNU GPL, v2 or later",
- layer = 0,
- enabled = true
- }
- end
- local repeat_orders = {}
- local mode_activated = false
- local activate_mode_key = 420
- local go_to_next_repeat_key = 421
- function widget:KeyPress(keyCode, mods, label, utf32char, scanCode, actionList)
- if #actionList then return end -- do nothing if engine has actions for these key pressed
- end
- function widget:KeyRelease(keyCode, mods, label, utf32char, scanCode, actionList)
- if #actionList then return end -- do nothing if engine has actions for these key pressed
- end
- function widget:UnitCommand(unitID, unitDefID, unitTeam, cmdID, cmdParams, options, cmdTag)
- --if not on repeat orders return
- end
- function widget:UnitDestroyed(unitID)
- if repeat_orders[unitID] then
- repeat_orders[unitID] = {}
- end
- end
- function widget:UnitTaken(unitIT)
- if repeat_orders[unitID] then
- repeat_orders[unitID] = {}
- end
- end
- function widget:UnitGiven(unitIT)
- if repeat_orders[unitID] then
- repeat_orders[unitID] = {}
- end
- end
- local millis_start_timer = Spring.GetTimer()
- local function millis()
- return math.ceil(Spring.DiffTimers(Spring.GetTimer(), millis_start_timer) * 1000)
- end
- local next_call = 0
- function widget:Update()
- local now_time = millis()
- if next_call > now_time then return end
- next_call = now_time + 1000
- Spring.Echo(os.date("%H:%M:%S:%MS"), mode_activated)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement