Compare commits
7 Commits
pre-releas
...
1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 07d115adc2 | |||
| 2b72360a9b | |||
| 9b5cea7372 | |||
| 1b1efbce6d | |||
| cdc4336ed5 | |||
| 73f4e4b0f5 | |||
| 54b75a869d |
96
.nvim.lua
Normal file
96
.nvim.lua
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
require("lua/lemon")
|
||||||
|
require("lua/snippets")
|
||||||
|
|
||||||
|
vim.opt.errorformat = table.concat({
|
||||||
|
-- '%f(%l\\,%c):\\ %tarning\\ %m\\ [%.%#]',
|
||||||
|
'%f(%l\\,%c):\\ %trror\\ %m\\ [%.%#]',
|
||||||
|
}, ',')
|
||||||
|
|
||||||
|
local def_workspace = { args = {}, build_type = "Debug", binary = "ng", build_target = "native", }
|
||||||
|
local workspace = InitWorkspace(def_workspace)
|
||||||
|
|
||||||
|
local bin_target
|
||||||
|
local bin_name
|
||||||
|
|
||||||
|
local function updateBuildEnv()
|
||||||
|
-- The run (F6) arguments
|
||||||
|
vim.opt.makeprg = "dotnet build"
|
||||||
|
end
|
||||||
|
|
||||||
|
updateBuildEnv()
|
||||||
|
|
||||||
|
-- Update args for both run and debug configs
|
||||||
|
local function updateArgs(args)
|
||||||
|
workspace.args = args
|
||||||
|
WriteWorkspace()
|
||||||
|
end
|
||||||
|
|
||||||
|
local function updateTarget(tgt)
|
||||||
|
if type(tgt) ~= "string" then
|
||||||
|
vim.api.nvim_echo({ { "Invalid target", "ErrorMsg" } }, false, {})
|
||||||
|
return
|
||||||
|
end
|
||||||
|
workspace.binary = tgt
|
||||||
|
updateBuildEnv()
|
||||||
|
WriteWorkspace()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- The Configure command
|
||||||
|
vim.api.nvim_create_user_command("Configure", function(a)
|
||||||
|
local build_type = "Debug"
|
||||||
|
local build_target = "native"
|
||||||
|
local a1 = a.fargs
|
||||||
|
if #a1 > 0 then build_type = a1[1] end
|
||||||
|
if #a1 > 1 then build_target = a1[2] end
|
||||||
|
vim.print(a1[1])
|
||||||
|
|
||||||
|
workspace.build_type = build_type
|
||||||
|
workspace.build_target = build_target
|
||||||
|
|
||||||
|
updateBuildEnv()
|
||||||
|
WriteWorkspace()
|
||||||
|
|
||||||
|
local args = {}
|
||||||
|
table.insert(args, "-B" .. build_folder)
|
||||||
|
table.insert(args, "-GNinja")
|
||||||
|
table.insert(args, "-DCMAKE_BUILD_TYPE=" .. build_type)
|
||||||
|
table.insert(args, "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON")
|
||||||
|
if workspace.build_target == 'web' then
|
||||||
|
table.insert(args, "-DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/Web.cmake")
|
||||||
|
table.insert(args, "-DTOOLS_HINT_PATH=" .. build_folder .. "/../b_Tool")
|
||||||
|
else
|
||||||
|
table.insert(args, "-DCMAKE_CXX_COMPILER=clang++")
|
||||||
|
table.insert(args, "-DCMAKE_C_COMPILER=clang")
|
||||||
|
end
|
||||||
|
-- Feed into cmd !cmake
|
||||||
|
|
||||||
|
vim.fn.feedkeys(":!cmake " .. table.concat(args, " "))
|
||||||
|
end, { nargs = '*', desc = "Update run/debug arguments" })
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command("Target", function(a) updateTarget(a.args) end,
|
||||||
|
{ nargs = 1, desc = "Update run/debug target" })
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command("Args", function(a) updateArgs(a.fargs) end,
|
||||||
|
{ nargs = '*', desc = "Update run/debug arguments" })
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command("ReloadWorkspace", function(a)
|
||||||
|
workspace = InitWorkspace(def_workspace)
|
||||||
|
updateBuildEnv()
|
||||||
|
end,
|
||||||
|
{ nargs = 0, desc = "Reload workspace debug/run configuration from file" })
|
||||||
|
|
||||||
|
-- F6 to run the application
|
||||||
|
local function buildAndRun(silent)
|
||||||
|
SaveAllCode()
|
||||||
|
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Esc>", true, false, true), "n", true)
|
||||||
|
vim.schedule(function()
|
||||||
|
MakeAnd(function() end, silent)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
local function buildAndRunSilent() buildAndRun(true) end
|
||||||
|
vim.keymap.set('n', '<F7>', buildAndRunSilent)
|
||||||
|
vim.keymap.set('i', '<F7>', buildAndRunSilent)
|
||||||
|
vim.keymap.set('n', '<F19>', buildAndRun)
|
||||||
|
vim.keymap.set('i', '<F19>', buildAndRun)
|
||||||
|
vim.keymap.set('n', '<S-F7>', buildAndRun)
|
||||||
|
vim.keymap.set('i', '<S-F7>', buildAndRun)
|
||||||
192
lua/lemon.lua
Normal file
192
lua/lemon.lua
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
Lemon = {
|
||||||
|
ws = {},
|
||||||
|
ws_file = '.nvim.workspace.lua',
|
||||||
|
term_buf = nil,
|
||||||
|
term_win_cmd = 'belowright 12split',
|
||||||
|
}
|
||||||
|
|
||||||
|
function LoadWorkspace()
|
||||||
|
-- Load persistent configuration from .workspace.lua
|
||||||
|
local loaded, workspace = pcall(dofile, Lemon.ws_file)
|
||||||
|
if not loaded then return nil end
|
||||||
|
return workspace
|
||||||
|
end
|
||||||
|
|
||||||
|
function WriteWorkspace()
|
||||||
|
-- A very minimal serializer for workspace configuration
|
||||||
|
local s = { l = "", ls = {}, i = "" }
|
||||||
|
local function w(v) s.l = s.l .. v end
|
||||||
|
local function nl()
|
||||||
|
s.ls[#s.ls + 1] = s.l; s.l = s.i;
|
||||||
|
end
|
||||||
|
local function wv(v)
|
||||||
|
local t = type(v)
|
||||||
|
if t == 'table' then
|
||||||
|
w('{'); local pi = s.i; s.i = s.i .. " "
|
||||||
|
for k1, v1 in pairs(v) do
|
||||||
|
nl(); w('['); wv(k1); w('] = '); wv(v1); w(',')
|
||||||
|
end
|
||||||
|
s.i = pi; nl(); w('}');
|
||||||
|
elseif t == 'number' then
|
||||||
|
w(tostring(v))
|
||||||
|
elseif t == 'string' then
|
||||||
|
w('"' .. v .. '"')
|
||||||
|
else
|
||||||
|
w(tostring(v))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Write the workspace file
|
||||||
|
w("return "); wv(Lemon.ws); nl()
|
||||||
|
vim.fn.writefile(s.ls, Lemon.ws_file)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Loads the workspace from the file, or return the default
|
||||||
|
---@param default table
|
||||||
|
---@return table
|
||||||
|
function InitWorkspace(default)
|
||||||
|
Lemon.ws = LoadWorkspace()
|
||||||
|
if Lemon.ws == nil then
|
||||||
|
Lemon.ws = default
|
||||||
|
end
|
||||||
|
return Lemon.ws
|
||||||
|
end
|
||||||
|
|
||||||
|
function TermShow()
|
||||||
|
local info = GetTermInfo()
|
||||||
|
|
||||||
|
if info == nil then
|
||||||
|
-- Create new terminal buffer
|
||||||
|
vim.cmd(Lemon.term_win_cmd)
|
||||||
|
vim.cmd('terminal')
|
||||||
|
Lemon.term_buf = vim.api.nvim_get_current_buf()
|
||||||
|
-- Mark buffer so we can identify it later
|
||||||
|
vim.api.nvim_buf_set_var(Lemon.term_buf, 'lemon_terminal', true)
|
||||||
|
info = GetTermInfo()
|
||||||
|
elseif info.win == nil then
|
||||||
|
-- Buffer exists but not visible, open it
|
||||||
|
vim.cmd(Lemon.term_win_cmd)
|
||||||
|
vim.api.nvim_win_set_buf(0, Lemon.term_buf)
|
||||||
|
else
|
||||||
|
-- Window is visible, switch to it
|
||||||
|
vim.api.nvim_set_current_win(info.win)
|
||||||
|
end
|
||||||
|
return info
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Find or create persistent terminal buffer, open window, and run command
|
||||||
|
function TermRun(cmd)
|
||||||
|
local info = TermShow()
|
||||||
|
|
||||||
|
-- Send command to terminal
|
||||||
|
vim.fn.chansend(info.job_id, '\021' .. cmd .. '\n')
|
||||||
|
vim.fn.feedkeys("G", "n")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Get terminal buffer and job_id if valid, returns {buf, job_id, win}
|
||||||
|
-- win is nil if terminal is not currently visible
|
||||||
|
function GetTermInfo()
|
||||||
|
if Lemon.term_buf == nil or not vim.api.nvim_buf_is_valid(Lemon.term_buf) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local job_id = vim.api.nvim_buf_get_var(Lemon.term_buf, 'terminal_job_id')
|
||||||
|
|
||||||
|
-- Find window showing the terminal buffer
|
||||||
|
local win = nil
|
||||||
|
for _, w in ipairs(vim.api.nvim_list_wins()) do
|
||||||
|
if vim.api.nvim_win_get_buf(w) == Lemon.term_buf then
|
||||||
|
win = w
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return { buf = Lemon.term_buf, job_id = job_id, win = win }
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Compatibility wrapper - returns window ID if terminal is visible
|
||||||
|
function SwitchToExistingTerm()
|
||||||
|
local info = GetTermInfo()
|
||||||
|
return info and info.win or nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function SaveAllCode()
|
||||||
|
-- Filetypes you want to save
|
||||||
|
local valid_ft = {
|
||||||
|
c = true,
|
||||||
|
cpp = true,
|
||||||
|
h = true,
|
||||||
|
hpp = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Iterate through all buffers
|
||||||
|
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
|
||||||
|
-- Only act on listed + loaded buffers
|
||||||
|
if vim.api.nvim_buf_is_loaded(buf) and vim.bo[buf].buflisted then
|
||||||
|
local ft = vim.bo[buf].filetype
|
||||||
|
|
||||||
|
-- If filetype matches, write the buffer
|
||||||
|
if valid_ft[ft] and vim.bo[buf].modified then
|
||||||
|
-- vim.print("Saving buffer", buf)
|
||||||
|
vim.api.nvim_buf_call(buf, function()
|
||||||
|
vim.cmd("write")
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Runs the make command and runs the callback when it completes
|
||||||
|
function MakeAnd(run_callback, silent_)
|
||||||
|
local silent
|
||||||
|
if silent_ ~= nil then
|
||||||
|
silent = silent_
|
||||||
|
else
|
||||||
|
silent = false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Create a one-time autocmd that fires when make completes
|
||||||
|
local group = vim.api.nvim_create_augroup('MakeAnd', { clear = false })
|
||||||
|
local wnd = vim.api.nvim_get_current_win()
|
||||||
|
local pos = vim.api.nvim_win_get_cursor(wnd)
|
||||||
|
vim.api.nvim_create_autocmd('QuickFixCmdPost', {
|
||||||
|
group = group,
|
||||||
|
pattern = 'make',
|
||||||
|
once = true,
|
||||||
|
callback = function()
|
||||||
|
local qf_list = vim.fn.getqflist()
|
||||||
|
local has_errors = false
|
||||||
|
|
||||||
|
for _, item in ipairs(qf_list) do
|
||||||
|
if item.valid == 1 then
|
||||||
|
has_errors = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.schedule(function()
|
||||||
|
if not has_errors then
|
||||||
|
vim.api.nvim_echo({ { "Build succeeded", "Normal" } }, false, {})
|
||||||
|
run_callback()
|
||||||
|
vim.api.nvim_win_set_cursor(wnd, pos)
|
||||||
|
else
|
||||||
|
vim.api.nvim_echo({ { "Build failed", "ErrorMsg" } }, false, {})
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
if silent then
|
||||||
|
vim.cmd('silent make!')
|
||||||
|
else
|
||||||
|
vim.cmd('make!')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function TabCurrent()
|
||||||
|
return vim.fn.tabpagenr()
|
||||||
|
end
|
||||||
|
|
||||||
|
function TabSwitch(tab)
|
||||||
|
vim.cmd('tabnext ' .. tab)
|
||||||
|
end
|
||||||
33
lua/snippets.lua
Normal file
33
lua/snippets.lua
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
-- Header guard snippet
|
||||||
|
vim.keymap.set('n', ',hg', function()
|
||||||
|
local function uuid()
|
||||||
|
local template = 'xxxxxxxx_xxxx_4xxx_yxxx_xxxxxxxxxxxx'
|
||||||
|
return string.gsub(template, '[xy]', function(c)
|
||||||
|
local v = (c == 'x') and math.random(0, 0xf) or math.random(8, 0xb)
|
||||||
|
return string.format('%X', v)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
local v = '_' .. uuid()
|
||||||
|
vim.api.nvim_put({ '#ifndef ' .. v,
|
||||||
|
"#define " .. v,
|
||||||
|
"",
|
||||||
|
"namespace ng {",
|
||||||
|
"",
|
||||||
|
"}",
|
||||||
|
"",
|
||||||
|
'#endif // ' .. v,
|
||||||
|
}, 'c', false, true)
|
||||||
|
vim.cmd("normal! 3k")
|
||||||
|
end, { desc = 'Inser header boiler plate' })
|
||||||
|
|
||||||
|
vim.keymap.set('n', ',xx', function()
|
||||||
|
local cmd = vim.api.nvim_replace_termcodes(":s/x/y/g<Left><Left>", true, true, true)
|
||||||
|
vim.api.nvim_feedkeys(cmd, "n", false)
|
||||||
|
end)
|
||||||
|
vim.keymap.set('n', ',xty', function()
|
||||||
|
vim.api.nvim_feedkeys("yyp", "n", false)
|
||||||
|
local cmd = vim.api.nvim_replace_termcodes(":s/x/y/g<CR>", true, true, true)
|
||||||
|
vim.api.nvim_feedkeys(cmd, "n", false)
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
17
make_links
Normal file → Executable file
17
make_links
Normal file → Executable file
@@ -1,8 +1,9 @@
|
|||||||
ln -s ILSpy -> /Applications/ILSpy.app/Contents/MacOS/ILSpy
|
#!/bin/bash
|
||||||
ln -s Libs -> /Users/bakje.coffee/Library/Application Support/Steam/steamapps/common/OxygenNotIncluded/OxygenNotIncluded.app/Contents/Resources/Data/Managed/
|
|
||||||
ln -s Logs -> /Users/bakje.coffee/Library/Logs/Klei/Oxygen Not Included
|
APP=~/.local/share/Steam/steamapps/common/OxygenNotIncluded
|
||||||
ln -s OxygenNotIncluded -> /Users/bakje.coffee/Library/Application Support/Steam/steamapps/common/OxygenNotIncluded
|
SAVE=~/.config/unity3d/Klei/Oxygen\ Not\ Included
|
||||||
ln -s OxygenNotIncludedData -> /Users/bakje.coffee/Library/Application Support/unity.Klei.Oxygen Not Included/
|
|
||||||
# 0 drwxr-xr-x 3093 bakje.coffee staff 98976 28 Dec 00:09 reference
|
set -ex
|
||||||
# 0 drwxr-xr-x 3 bakje.coffee staff 96 28 Dec 11:09 reference-OtherMods
|
ln -sf "$APP/OxygenNotIncluded_Data/Managed" Libs
|
||||||
# 0 drwxr-xr-x 385 bakje.coffee staff 12320 28 Dec 10:41 reference-firstpass
|
ln -sf "$APP" OxygenNotIncluded
|
||||||
|
ln -sf "$SAVE" OxygenNotIncludedData
|
||||||
|
|||||||
8
make_links_osx
Normal file
8
make_links_osx
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
ln -s ILSpy -> /Applications/ILSpy.app/Contents/MacOS/ILSpy
|
||||||
|
ln -s Libs -> /Users/bakje.coffee/Library/Application Support/Steam/steamapps/common/OxygenNotIncluded/OxygenNotIncluded.app/Contents/Resources/Data/Managed/
|
||||||
|
ln -s Logs -> /Users/bakje.coffee/Library/Logs/Klei/Oxygen Not Included
|
||||||
|
ln -s OxygenNotIncluded -> /Users/bakje.coffee/Library/Application Support/Steam/steamapps/common/OxygenNotIncluded
|
||||||
|
ln -s OxygenNotIncludedData -> /Users/bakje.coffee/Library/Application Support/unity.Klei.Oxygen Not Included/
|
||||||
|
# 0 drwxr-xr-x 3093 bakje.coffee staff 98976 28 Dec 00:09 reference
|
||||||
|
# 0 drwxr-xr-x 3 bakje.coffee staff 96 28 Dec 11:09 reference-OtherMods
|
||||||
|
# 0 drwxr-xr-x 385 bakje.coffee staff 12320 28 Dec 10:41 reference-firstpass
|
||||||
4
make_links_win
Normal file
4
make_links_win
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
ln -s "C:\Users\Guus\AppData\LocalLow\Klei\Oxygen Not Included" Logs
|
||||||
|
ln -s "C:\Program Files (x86)\Steam\steamapps\common\OxygenNotIncluded" OxygenNotIncluded
|
||||||
|
ln -s "C:\Users\Guus\Documents\Klei\OxygenNotIncluded" OxygenNotIncludedData
|
||||||
|
ln -s "C:\Program Files (x86)\Steam\steamapps\common\OxygenNotIncluded\OxygenNotIncluded_Data\Managed" Libs
|
||||||
@@ -20,11 +20,11 @@ namespace PriorityUX {
|
|||||||
|
|
||||||
public override void OnLoad(Harmony harmony) {
|
public override void OnLoad(Harmony harmony) {
|
||||||
Debug.Log("UX Mod Load");
|
Debug.Log("UX Mod Load");
|
||||||
Harmony.DEBUG = true;
|
// Harmony.DEBUG = true;
|
||||||
|
|
||||||
base.OnLoad(harmony);
|
base.OnLoad(harmony);
|
||||||
|
|
||||||
Debug.Log("UX Mod PostLoad base");
|
// Debug.Log("UX Mod PostLoad base");
|
||||||
|
|
||||||
PUtil.InitLibrary();
|
PUtil.InitLibrary();
|
||||||
LocString.CreateLocStringKeys(typeof(Strings.PRIORITYUX));
|
LocString.CreateLocStringKeys(typeof(Strings.PRIORITYUX));
|
||||||
|
|||||||
@@ -1,271 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2022 Peter Han
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
||||||
* and associated documentation files (the "Software"), to deal in the Software without
|
|
||||||
* restriction, including without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in all copies or
|
|
||||||
* substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
|
||||||
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
||||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
using PeterHan.PLib.Core;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace PeterHan.PLib.Buildings {
|
|
||||||
/// <summary>
|
|
||||||
/// A visualizer that colors cells with an overlay when a building is selected or being
|
|
||||||
/// previewed.
|
|
||||||
/// </summary>
|
|
||||||
public abstract class ColoredRangeVisualizer : KMonoBehaviour {
|
|
||||||
/// <summary>
|
|
||||||
/// The anim name to use when visualizing.
|
|
||||||
/// </summary>
|
|
||||||
private const string ANIM_NAME = "transferarmgrid_kanim";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The animations to play when the visualization is created.
|
|
||||||
/// </summary>
|
|
||||||
private static readonly HashedString[] PRE_ANIMS = new HashedString[] {
|
|
||||||
"grid_pre",
|
|
||||||
"grid_loop"
|
|
||||||
};
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The animation to play when the visualization is destroyed.
|
|
||||||
/// </summary>
|
|
||||||
private static readonly HashedString POST_ANIM = "grid_pst";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The layer on which to display the visualizer.
|
|
||||||
/// </summary>
|
|
||||||
public Grid.SceneLayer Layer { get; set; }
|
|
||||||
|
|
||||||
// These components are automatically populated by KMonoBehaviour
|
|
||||||
#pragma warning disable IDE0044 // Add readonly modifier
|
|
||||||
#pragma warning disable CS0649
|
|
||||||
[MyCmpGet]
|
|
||||||
protected BuildingPreview preview;
|
|
||||||
|
|
||||||
[MyCmpGet]
|
|
||||||
protected Rotatable rotatable;
|
|
||||||
#pragma warning restore CS0649
|
|
||||||
#pragma warning restore IDE0044 // Add readonly modifier
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The cells where animations are being displayed.
|
|
||||||
/// </summary>
|
|
||||||
private readonly HashSet<VisCellData> cells;
|
|
||||||
|
|
||||||
protected ColoredRangeVisualizer() {
|
|
||||||
cells = new HashSet<VisCellData>();
|
|
||||||
Layer = Grid.SceneLayer.FXFront;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates or updates the visualizers as necessary.
|
|
||||||
/// </summary>
|
|
||||||
private void CreateVisualizers() {
|
|
||||||
var visCells = HashSetPool<VisCellData, ColoredRangeVisualizer>.Allocate();
|
|
||||||
var newCells = ListPool<VisCellData, ColoredRangeVisualizer>.Allocate();
|
|
||||||
try {
|
|
||||||
if (gameObject != null)
|
|
||||||
VisualizeCells(visCells);
|
|
||||||
// Destroy cells that are not used in the new one
|
|
||||||
foreach (var cell in cells)
|
|
||||||
if (visCells.Remove(cell))
|
|
||||||
newCells.Add(cell);
|
|
||||||
else
|
|
||||||
cell.Destroy();
|
|
||||||
// Newcomers get their controller created and added to the list
|
|
||||||
foreach (var newCell in visCells) {
|
|
||||||
newCell.CreateController(Layer);
|
|
||||||
newCells.Add(newCell);
|
|
||||||
}
|
|
||||||
// Copy back to global
|
|
||||||
cells.Clear();
|
|
||||||
foreach (var cell in newCells)
|
|
||||||
cells.Add(cell);
|
|
||||||
} finally {
|
|
||||||
visCells.Recycle();
|
|
||||||
newCells.Recycle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when cells are changed in the building radius.
|
|
||||||
/// </summary>
|
|
||||||
private void OnCellChange() {
|
|
||||||
CreateVisualizers();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnCleanUp() {
|
|
||||||
Unsubscribe((int)GameHashes.SelectObject);
|
|
||||||
if (preview != null) {
|
|
||||||
Singleton<CellChangeMonitor>.Instance.UnregisterCellChangedHandler(transform,
|
|
||||||
OnCellChange);
|
|
||||||
if (rotatable != null)
|
|
||||||
Unsubscribe((int)GameHashes.Rotated);
|
|
||||||
}
|
|
||||||
RemoveVisualizers();
|
|
||||||
base.OnCleanUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when the object is rotated.
|
|
||||||
/// </summary>
|
|
||||||
private void OnRotated(object _) {
|
|
||||||
CreateVisualizers();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when the object is selected.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">true if selected, or false if deselected.</param>
|
|
||||||
private void OnSelect(object data) {
|
|
||||||
if (data is bool selected) {
|
|
||||||
var position = transform.position;
|
|
||||||
// Play the appropriate sound and update the visualizers
|
|
||||||
if (selected) {
|
|
||||||
PGameUtils.PlaySound("RadialGrid_form", position);
|
|
||||||
CreateVisualizers();
|
|
||||||
} else {
|
|
||||||
PGameUtils.PlaySound("RadialGrid_disappear", position);
|
|
||||||
RemoveVisualizers();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnSpawn() {
|
|
||||||
base.OnSpawn();
|
|
||||||
Subscribe((int)GameHashes.SelectObject, OnSelect);
|
|
||||||
if (preview != null) {
|
|
||||||
// Previews can be moved
|
|
||||||
Singleton<CellChangeMonitor>.Instance.RegisterCellChangedHandler(transform,
|
|
||||||
OnCellChange, nameof(ColoredRangeVisualizer) + ".OnSpawn");
|
|
||||||
if (rotatable != null)
|
|
||||||
Subscribe((int)GameHashes.Rotated, OnRotated);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Removes all of the visualizers.
|
|
||||||
/// </summary>
|
|
||||||
private void RemoveVisualizers() {
|
|
||||||
foreach (var cell in cells)
|
|
||||||
cell.Destroy();
|
|
||||||
cells.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Calculates the offset cell from the specified starting point, including the
|
|
||||||
/// rotation of this object.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="baseCell">The starting cell.</param>
|
|
||||||
/// <param name="offset">The offset if the building had its default rotation.</param>
|
|
||||||
/// <returns>The computed destination cell.</returns>
|
|
||||||
protected int RotateOffsetCell(int baseCell, CellOffset offset) {
|
|
||||||
if (rotatable != null)
|
|
||||||
offset = rotatable.GetRotatedCellOffset(offset);
|
|
||||||
return Grid.OffsetCell(baseCell, offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Called when cell visualizations need to be updated. Visualized cells should be
|
|
||||||
/// added to the collection supplied as an argument.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="newCells">The cells which should be visualized.</param>
|
|
||||||
protected abstract void VisualizeCells(ICollection<VisCellData> newCells);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Stores the data about a particular cell, including its anim controller and tint
|
|
||||||
/// color.
|
|
||||||
/// </summary>
|
|
||||||
protected sealed class VisCellData : IComparable<VisCellData> {
|
|
||||||
/// <summary>
|
|
||||||
/// The target cell.
|
|
||||||
/// </summary>
|
|
||||||
public int Cell { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The anim controller for this cell.
|
|
||||||
/// </summary>
|
|
||||||
public KBatchedAnimController Controller { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The tint used for this cell.
|
|
||||||
/// </summary>
|
|
||||||
public Color Tint { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a visualized cell.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cell">The cell to visualize.</param>
|
|
||||||
public VisCellData(int cell) : this(cell, Color.white) { }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a visualized cell.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="cell">The cell to visualize.</param>
|
|
||||||
/// <param name="tint">The color to tint it.</param>
|
|
||||||
public VisCellData(int cell, Color tint) {
|
|
||||||
Cell = cell;
|
|
||||||
Controller = null;
|
|
||||||
Tint = tint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int CompareTo(VisCellData other) {
|
|
||||||
if (other == null)
|
|
||||||
throw new ArgumentNullException(nameof(other));
|
|
||||||
return Cell.CompareTo(other.Cell);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates the anim controller for this cell.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sceneLayer">The layer on which to display the animation.</param>
|
|
||||||
public void CreateController(Grid.SceneLayer sceneLayer) {
|
|
||||||
Controller = FXHelpers.CreateEffect(ANIM_NAME, Grid.CellToPosCCC(Cell,
|
|
||||||
sceneLayer), null, false, sceneLayer, true);
|
|
||||||
Controller.destroyOnAnimComplete = false;
|
|
||||||
Controller.visibilityType = KAnimControllerBase.VisibilityType.Always;
|
|
||||||
Controller.gameObject.SetActive(true);
|
|
||||||
Controller.Play(PRE_ANIMS, KAnim.PlayMode.Loop);
|
|
||||||
Controller.TintColour = Tint;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Destroys the anim controller for this cell.
|
|
||||||
/// </summary>
|
|
||||||
public void Destroy() {
|
|
||||||
if (Controller != null) {
|
|
||||||
Controller.destroyOnAnimComplete = true;
|
|
||||||
Controller.Play(POST_ANIM, KAnim.PlayMode.Once, 1f, 0f);
|
|
||||||
Controller = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Equals(object obj) {
|
|
||||||
return obj is VisCellData other && other.Cell == Cell && Tint.Equals(other.
|
|
||||||
Tint);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int GetHashCode() {
|
|
||||||
return Cell;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString() {
|
|
||||||
return "CellData[cell={0:D},color={1}]".F(Cell, Tint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -37,11 +37,11 @@ namespace PeterHan.PLib.Buildings {
|
|||||||
private static void ApplyAlwaysOperational(GameObject go) {
|
private static void ApplyAlwaysOperational(GameObject go) {
|
||||||
// Remove default components that could make a building non-operational
|
// Remove default components that could make a building non-operational
|
||||||
if (go.TryGetComponent(out BuildingEnabledButton enabled))
|
if (go.TryGetComponent(out BuildingEnabledButton enabled))
|
||||||
Object.DestroyImmediate(enabled);
|
UnityEngine.Object.DestroyImmediate(enabled);
|
||||||
if (go.TryGetComponent(out Operational op))
|
if (go.TryGetComponent(out Operational op))
|
||||||
Object.DestroyImmediate(op);
|
UnityEngine.Object.DestroyImmediate(op);
|
||||||
if (go.TryGetComponent(out LogicPorts lp))
|
if (go.TryGetComponent(out LogicPorts lp))
|
||||||
Object.DestroyImmediate(lp);
|
UnityEngine.Object.DestroyImmediate(lp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
|
using System;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using KMod;
|
using KMod;
|
||||||
|
|
||||||
namespace PriorityUX {
|
namespace PriorityUX
|
||||||
|
{
|
||||||
[HarmonyDebug]
|
[HarmonyDebug]
|
||||||
[HarmonyPatch(typeof(Deconstructable))]
|
[HarmonyPatch(typeof(Deconstructable))]
|
||||||
public class DeconstructablePatches {
|
public class DeconstructablePatches
|
||||||
public static PrioritySetting getChorePriority() {
|
{
|
||||||
|
public static PrioritySetting getChorePriority()
|
||||||
|
{
|
||||||
Debug.Log("Getting deconstruct chore priority");
|
Debug.Log("Getting deconstruct chore priority");
|
||||||
if (Options.Instance.deconstructInheritPriority)
|
if (Options.Instance.deconstructInheritPriority)
|
||||||
return Utils.getLastPriority();
|
return Utils.getLastPriority();
|
||||||
@@ -16,59 +20,63 @@ namespace PriorityUX {
|
|||||||
return Utils.getDefaultPriority();
|
return Utils.getDefaultPriority();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPatch(new Type[] { typeof(bool) })]
|
||||||
[HarmonyPatch("QueueDeconstruction")]
|
[HarmonyPatch("QueueDeconstruction")]
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
static void QueueDeconstruction_Postfix(Deconstructable __instance) {
|
static void QueueDeconstruction_Postfix(Deconstructable __instance)
|
||||||
|
{
|
||||||
Prioritizable prioritizable = __instance.GetComponent<Prioritizable>();
|
Prioritizable prioritizable = __instance.GetComponent<Prioritizable>();
|
||||||
if (prioritizable != null) {
|
if (prioritizable != null)
|
||||||
|
{
|
||||||
Debug.Log("Updating deconstruct priority");
|
Debug.Log("Updating deconstruct priority");
|
||||||
prioritizable.SetMasterPriority(getChorePriority());
|
prioritizable.SetMasterPriority(getChorePriority());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
[HarmonyPatch("QueueDeconstruction")]
|
|
||||||
[HarmonyTranspiler]
|
|
||||||
static IEnumerable<CodeInstruction> QueueDeconstruction_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator ilGenerator) {
|
|
||||||
Harmony.DEBUG = true;
|
|
||||||
|
|
||||||
var priorityLocal = ilGenerator.DeclareLocal(typeof(int));
|
/*
|
||||||
var priorityClassLocal = ilGenerator.DeclareLocal(typeof(PriorityScreen.PriorityClass));
|
[HarmonyPatch("QueueDeconstruction")]
|
||||||
var tmpLocal0 = ilGenerator.DeclareLocal(typeof(int));
|
[HarmonyTranspiler]
|
||||||
var tmpLocal1 = ilGenerator.DeclareLocal(typeof(int));
|
static IEnumerable<CodeInstruction> QueueDeconstruction_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator ilGenerator) {
|
||||||
yield return CodeInstruction.Call(typeof(DeconstructablePatches), nameof(getChorePriority));
|
Harmony.DEBUG = true;
|
||||||
yield return new CodeInstruction(OpCodes.Dup);
|
|
||||||
// yield return new CodeInstruction(OpCodes.Pop);
|
|
||||||
// yield return new CodeInstruction(OpCodes.Pop);
|
|
||||||
yield return CodeInstruction.LoadField(typeof(PrioritySetting), nameof(PrioritySetting.priority_value));
|
|
||||||
yield return new CodeInstruction(OpCodes.Stloc, priorityLocal.LocalIndex);
|
|
||||||
yield return CodeInstruction.LoadField(typeof(PrioritySetting), nameof(PrioritySetting.priority_class));
|
|
||||||
yield return new CodeInstruction(OpCodes.Stloc, priorityClassLocal.LocalIndex);
|
|
||||||
|
|
||||||
ConstructorInfo choreConstructor = typeof(WorkChore<Deconstructable>).GetConstructors()[0];
|
var priorityLocal = ilGenerator.DeclareLocal(typeof(int));
|
||||||
// FieldInfo field = typeof(Deconstructable).GetField(nameof(Deconstructable.chore));
|
var priorityClassLocal = ilGenerator.DeclareLocal(typeof(PriorityScreen.PriorityClass));
|
||||||
foreach (var instruction in instructions) {
|
var tmpLocal0 = ilGenerator.DeclareLocal(typeof(int));
|
||||||
// IL_0087: ldc.i4.1
|
var tmpLocal1 = ilGenerator.DeclareLocal(typeof(int));
|
||||||
// IL_0088: ldc.i4.0 // priority_class
|
yield return CodeInstruction.Call(typeof(DeconstructablePatches), nameof(getChorePriority));
|
||||||
// IL_0089: ldc.i4.5 // priority_value
|
yield return new CodeInstruction(OpCodes.Dup);
|
||||||
// IL_008a: ldc.i4.1
|
// yield return new CodeInstruction(OpCodes.Pop);
|
||||||
// IL_008b: ldc.i4.1
|
// yield return new CodeInstruction(OpCodes.Pop);
|
||||||
// IL_008c: newobj instance void class WorkChore`1<class Deconstructable>::.ctor(class ChoreType, class ['Assembly-CSharp-firstpass']IStateMachineTarget, class ChoreProvider, bool, class [mscorlib]System.Action`1<class Chore>, class [mscorlib]System.Action`1<class Chore>, class [mscorlib]System.Action`1<class Chore>, bool, class ScheduleBlockType, bool, bool, class ['Assembly-CSharp-firstpass']KAnimFile, bool, bool, bool, valuetype PriorityScreen/PriorityClass, int32, bool, bool)
|
yield return CodeInstruction.LoadField(typeof(PrioritySetting), nameof(PrioritySetting.priority_value));
|
||||||
// IL_0091: stfld class Chore Deconstructable::chore
|
yield return new CodeInstruction(OpCodes.Stloc, priorityLocal.LocalIndex);
|
||||||
if (instruction.OperandIs(choreConstructor)) {
|
yield return CodeInstruction.LoadField(typeof(PrioritySetting), nameof(PrioritySetting.priority_class));
|
||||||
Debug.Log("PATCHING CHORE CONSTRUCTOR\n" + System.Environment.StackTrace);
|
yield return new CodeInstruction(OpCodes.Stloc, priorityClassLocal.LocalIndex);
|
||||||
yield return new CodeInstruction(OpCodes.Stloc, tmpLocal1.LocalIndex);
|
|
||||||
yield return new CodeInstruction(OpCodes.Stloc, tmpLocal0.LocalIndex);
|
ConstructorInfo choreConstructor = typeof(WorkChore<Deconstructable>).GetConstructors()[0];
|
||||||
yield return new CodeInstruction(OpCodes.Pop);
|
// FieldInfo field = typeof(Deconstructable).GetField(nameof(Deconstructable.chore));
|
||||||
yield return new CodeInstruction(OpCodes.Pop);
|
foreach (var instruction in instructions) {
|
||||||
yield return new CodeInstruction(OpCodes.Ldloc, priorityClassLocal.LocalIndex);
|
// IL_0087: ldc.i4.1
|
||||||
yield return new CodeInstruction(OpCodes.Ldloc, priorityLocal.LocalIndex);
|
// IL_0088: ldc.i4.0 // priority_class
|
||||||
yield return new CodeInstruction(OpCodes.Ldloc, tmpLocal0.LocalIndex);
|
// IL_0089: ldc.i4.5 // priority_value
|
||||||
yield return new CodeInstruction(OpCodes.Ldloc, tmpLocal1.LocalIndex);
|
// IL_008a: ldc.i4.1
|
||||||
|
// IL_008b: ldc.i4.1
|
||||||
|
// IL_008c: newobj instance void class WorkChore`1<class Deconstructable>::.ctor(class ChoreType, class ['Assembly-CSharp-firstpass']IStateMachineTarget, class ChoreProvider, bool, class [mscorlib]System.Action`1<class Chore>, class [mscorlib]System.Action`1<class Chore>, class [mscorlib]System.Action`1<class Chore>, bool, class ScheduleBlockType, bool, bool, class ['Assembly-CSharp-firstpass']KAnimFile, bool, bool, bool, valuetype PriorityScreen/PriorityClass, int32, bool, bool)
|
||||||
|
// IL_0091: stfld class Chore Deconstructable::chore
|
||||||
|
if (instruction.OperandIs(choreConstructor)) {
|
||||||
|
Debug.Log("PATCHING CHORE CONSTRUCTOR\n" + System.Environment.StackTrace);
|
||||||
|
yield return new CodeInstruction(OpCodes.Stloc, tmpLocal1.LocalIndex);
|
||||||
|
yield return new CodeInstruction(OpCodes.Stloc, tmpLocal0.LocalIndex);
|
||||||
|
yield return new CodeInstruction(OpCodes.Pop);
|
||||||
|
yield return new CodeInstruction(OpCodes.Pop);
|
||||||
|
yield return new CodeInstruction(OpCodes.Ldloc, priorityClassLocal.LocalIndex);
|
||||||
|
yield return new CodeInstruction(OpCodes.Ldloc, priorityLocal.LocalIndex);
|
||||||
|
yield return new CodeInstruction(OpCodes.Ldloc, tmpLocal0.LocalIndex);
|
||||||
|
yield return new CodeInstruction(OpCodes.Ldloc, tmpLocal1.LocalIndex);
|
||||||
|
yield return instruction;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
yield return instruction;
|
yield return instruction;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
yield return instruction;
|
} */
|
||||||
}
|
|
||||||
} */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,14 @@ namespace PriorityUX {
|
|||||||
[HarmonyPatch(nameof(MaterialSelectionPanel.RefreshSelectors))]
|
[HarmonyPatch(nameof(MaterialSelectionPanel.RefreshSelectors))]
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
static void RefreshSelectorsPostfix(PriorityScreen ___priorityScreen) {
|
static void RefreshSelectorsPostfix(PriorityScreen ___priorityScreen) {
|
||||||
|
if (___priorityScreen == null) {
|
||||||
|
Debug.Log("RefreshSelectors ___priorityScreen is null");
|
||||||
|
return;
|
||||||
|
}
|
||||||
Debug.Log("RefreshSelectors");
|
Debug.Log("RefreshSelectors");
|
||||||
Debug.Log("___priorityScreen.gameObject.activeSelf: " + ___priorityScreen.gameObject.activeSelf);
|
if (___priorityScreen.gameObject != null) {
|
||||||
|
Debug.Log("___priorityScreen.gameObject.activeSelf: " + ___priorityScreen.gameObject.activeSelf);
|
||||||
|
}
|
||||||
// if (___priorityScreen.gameObject.activeSelf)
|
// if (___priorityScreen.gameObject.activeSelf)
|
||||||
Utils.refreshPriorityScreen(___priorityScreen);
|
Utils.refreshPriorityScreen(___priorityScreen);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,20 @@ namespace PriorityUX {
|
|||||||
public static LocString TOOLTIP = "Used for reset and as a default priority";
|
public static LocString TOOLTIP = "Used for reset and as a default priority";
|
||||||
public static LocString CATEGORY = "Tweaks";
|
public static LocString CATEGORY = "Tweaks";
|
||||||
}
|
}
|
||||||
public static class ENABLEPRIORITYHOTKEYSEVERYWHERE {
|
public static class ENABLEKEYSFORBUILDING {
|
||||||
public static LocString NAME = "Enable priority keys everywhere";
|
public static LocString NAME = "Enable priority keys in the build menu";
|
||||||
public static LocString TOOLTIP = "Allows the 1-9 keys to select priority for all tools. Close the tool to open the building menus.";
|
public static LocString TOOLTIP = "Allows the 1-9 keys to select priority in the building menu. Close the tool to open the building menus.";
|
||||||
public static LocString CATEGORY = "Tweaks";
|
public static LocString CATEGORY = "Toggles";
|
||||||
|
}
|
||||||
|
public static class DECONSTRUCTINHERITPRIORITY {
|
||||||
|
public static LocString NAME = "Use last priority for deconstruction";
|
||||||
|
public static LocString TOOLTIP = "Use the last priority for deconstruction. If disabled, the default priority will be used every time the menu is opened.";
|
||||||
|
public static LocString CATEGORY = "Toggles";
|
||||||
|
}
|
||||||
|
public static class ENABLEKEYSFORALLTOOLS {
|
||||||
|
public static LocString NAME = "Enable priority keys for all tools";
|
||||||
|
public static LocString TOOLTIP = "Will enable the 1-9 keys for all tools.";
|
||||||
|
public static LocString CATEGORY = "Toggles";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
mod/build
12
mod/build
@@ -1,15 +1,19 @@
|
|||||||
#/bin/bash
|
#/bin/bash
|
||||||
|
|
||||||
msbuild=/Library/Frameworks/Mono.framework/Versions/6.12.0/bin/msbuild
|
|
||||||
|
|
||||||
ROOT=$( cd "$(dirname "$0")" ; pwd -P )
|
ROOT=$( cd "$(dirname "$0")" ; pwd -P )
|
||||||
pushd $ROOT
|
pushd $ROOT
|
||||||
|
|
||||||
# Do the build (need to use mono)
|
# Do the build (need to use mono)
|
||||||
$msbuild
|
dotnet build -c Release
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
mkdir dist
|
mkdir dist
|
||||||
cp bin/Debug/net48/oni-prio.dll dist/
|
# cp bin/Debug/net48/oni-prio.dll dist/
|
||||||
|
cp bin/Release/net48/oni-prio.dll dist/
|
||||||
cp -r meta/* dist/
|
cp -r meta/* dist/
|
||||||
|
|
||||||
|
MODPATH=../OxygenNotIncludedData/mods/Local/PriorityUX
|
||||||
|
rm -rf $MODPATH
|
||||||
|
mkdir -p $MODPATH
|
||||||
|
cp dist/* $MODPATH
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net48</TargetFramework>
|
<TargetFramework>net48</TargetFramework>
|
||||||
<RootNamespace>oni_prio</RootNamespace>
|
<RootNamespace>oni_prio</RootNamespace>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<LangVersion>8.0</LangVersion>
|
<LangVersion>10.0</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Assembly-CSharp-firstpass">
|
<Reference Include="Assembly-CSharp-firstpass">
|
||||||
|
|||||||
@@ -5,10 +5,6 @@ VisualStudioVersion = 17.0.31903.59
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "oni-prio", "mod\oni-prio.csproj", "{B5C0FB18-102D-434C-B8D7-2DDAE54367D6}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "oni-prio", "mod\oni-prio.csproj", "{B5C0FB18-102D-434C-B8D7-2DDAE54367D6}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "reference\Assembly-CSharp.csproj", "{501D90AF-582D-4F90-9FE6-1479FBA92A4B}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-firstpass", "reference-firstpass\Assembly-CSharp-firstpass.csproj", "{F0AD7234-F5CE-4A5E-8E8A-F621F0B7C0A0}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|||||||
Reference in New Issue
Block a user