⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmd_savequeue.lua

📁 这是整套横扫千军3D版游戏的源码
💻 LUA
字号:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------  file:    cmd_savequeue.lua--  brief:   adds command to save and append a unit's queued commands--  author:  Dave Rodgers----  Copyright (C) 2007.--  Licensed under the terms of the GNU GPL, v2 or later.------------------------------------------------------------------------------------------------------------------------------------------------------------------function widget:GetInfo()  return {    name      = "SaveQueue",    desc      = "Adds '/luaui savequeue' and '/luaui loadqueue' commands",    author    = "trepan",    date      = "Jan 8, 2007",    license   = "GNU GPL, v2 or later",    layer     = 0,    enabled   = false  --  loaded by default?  }end----------------------------------------------------------------------------------------------------------------------------------------------------------------local savedQueue = {}----------------------------------------------------------------------------------------------------------------------------------------------------------------local function SaveQueue()  local uTable = Spring.GetSelectedUnits()  for _,uid in ipairs(uTable) do    savedQueue[uid] = Spring.GetCommandQueue(uid)  end  return trueendlocal function LoadQueue()  local selUnits = Spring.GetSelectedUnits()  for _,uid in ipairs(selUnits) do    local queue = savedQueue[uid]    if (queue ~= nil) then      for k,cmd in ipairs(queue) do  --  in order        if (not cmd.options.internal) then          local opts = {}          table.insert(opts, "shift") -- appending          if (cmd.options.alt)   then table.insert(opts, "alt")   end          if (cmd.options.ctrl)  then table.insert(opts, "ctrl")  end          if (cmd.options.right) then table.insert(opts, "right") end          Spring.GiveOrderToUnit(uid, cmd.id, cmd.params, opts)        end      end    end  end  return trueend----------------------------------------------------------------------------------------------------------------------------------------------------------------function widget:Initialize()  widgetHandler:AddAction("savequeue", SaveQueue)  widgetHandler:AddAction("loadqueue", LoadQueue)end   ----------------------------------------------------------------------------------------------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -