Skip to content

Commit

Permalink
Merge branch 'main' into fix/namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesClarke7283 authored Oct 15, 2023
2 parents b3ad6e2 + 1bd9c45 commit bd7fd4c
Show file tree
Hide file tree
Showing 20 changed files with 426 additions and 97 deletions.
22 changes: 16 additions & 6 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
-- This file is part of ComputerTest Redo.
--[[
This file is part of Modular Computers.
Modular Computers is free software: you can redistribute it and/or modify it under the terms of the
GNU Affero General Public License as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
-- ComputerTest Redo is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-- ComputerTest Redo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
-- You should have received a copy of the GNU Affero General Public License along with ComputerTest Redo. If not, see <https://www.gnu.org/licenses/>.
-- The license is included in the project root under the file labeled LICENSE. All files not otherwise specified under a different license shall be put under this license.
Modular Computers is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Modular Computers.
If not, see <https://www.gnu.org/licenses/>.
The license is included in the project root under the file labeled LICENSE. All files not otherwise
specified under a different license shall be put under this license.
Copyright (c) 2023 James Clarke <james@jamesdavidclarke.com>
]]

-- global mod namespace
modular_computers = {}
Expand All @@ -19,7 +30,6 @@ modular_computers.S = minetest.get_translator(modular_computers.mod.name)

-- Load the scripts
dofile(modular_computers.mod.path .. "/src/utilities.lua")
dofile(modular_computers.mod.path .. "/src/item_tracking.lua")
dofile(modular_computers.mod.path .. "/src/os/init.lua")
dofile(modular_computers.mod.path .. "/src/nodes/init.lua")
dofile(modular_computers.mod.path .. "/src/items/init.lua")
1 change: 0 additions & 1 deletion src/item_tracking.lua

This file was deleted.

18 changes: 18 additions & 0 deletions src/items/init.lua
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
--[[
This file is part of Modular Computers.
Modular Computers is free software: you can redistribute it and/or modify it under the terms of the
GNU Affero General Public License as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
Modular Computers is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Modular Computers.
If not, see <https://www.gnu.org/licenses/>.
The license is included in the project root under the file labeled LICENSE. All files not otherwise
specified under a different license shall be put under this license.
Copyright (c) 2023 James Clarke <james@jamesdavidclarke.com>
]]

dofile(modular_computers.mod.path .. "/src/items/motherboards/init.lua")
18 changes: 18 additions & 0 deletions src/items/motherboards/attached/inventory.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
--[[
This file is part of Modular Computers.
Modular Computers is free software: you can redistribute it and/or modify it under the terms of the
GNU Affero General Public License as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
Modular Computers is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Modular Computers.
If not, see <https://www.gnu.org/licenses/>.
The license is included in the project root under the file labeled LICENSE. All files not otherwise
specified under a different license shall be put under this license.
Copyright (c) 2023 James Clarke <james@jamesdavidclarke.com>
]]

function modular_computers.motherboard.delete_attached_inventory(id)
local motherboard_attached_inventories =
minetest.deserialize(modular_computers.mod_storage:get_string(
Expand Down
18 changes: 18 additions & 0 deletions src/items/motherboards/attached/tier.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
--[[
This file is part of Modular Computers.
Modular Computers is free software: you can redistribute it and/or modify it under the terms of the
GNU Affero General Public License as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
Modular Computers is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Modular Computers.
If not, see <https://www.gnu.org/licenses/>.
The license is included in the project root under the file labeled LICENSE. All files not otherwise
specified under a different license shall be put under this license.
Copyright (c) 2023 James Clarke <james@jamesdavidclarke.com>
]]

function modular_computers.motherboard.save_tier(id, tier_number)
-- Get the saved inventories data from mod storage
local motherboard_tiers = minetest.deserialize(
Expand Down
18 changes: 18 additions & 0 deletions src/items/motherboards/event_handlers.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
--[[
This file is part of Modular Computers.
Modular Computers is free software: you can redistribute it and/or modify it under the terms of the
GNU Affero General Public License as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
Modular Computers is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Modular Computers.
If not, see <https://www.gnu.org/licenses/>.
The license is included in the project root under the file labeled LICENSE. All files not otherwise
specified under a different license shall be put under this license.
Copyright (c) 2023 James Clarke <james@jamesdavidclarke.com>
]]

minetest.register_on_mods_loaded(function()
local inventory_ids = modular_computers.motherboard.list_saved_inventories()
for _, id in ipairs(inventory_ids) do
Expand Down
18 changes: 18 additions & 0 deletions src/items/motherboards/init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
--[[
This file is part of Modular Computers.
Modular Computers is free software: you can redistribute it and/or modify it under the terms of the
GNU Affero General Public License as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
Modular Computers is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Modular Computers.
If not, see <https://www.gnu.org/licenses/>.
The license is included in the project root under the file labeled LICENSE. All files not otherwise
specified under a different license shall be put under this license.
Copyright (c) 2023 James Clarke <james@jamesdavidclarke.com>
]]

modular_computers.motherboards = {}
modular_computers.motherboard = {}

Expand Down
18 changes: 18 additions & 0 deletions src/items/motherboards/inventory.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
--[[
This file is part of Modular Computers.
Modular Computers is free software: you can redistribute it and/or modify it under the terms of the
GNU Affero General Public License as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
Modular Computers is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Modular Computers.
If not, see <https://www.gnu.org/licenses/>.
The license is included in the project root under the file labeled LICENSE. All files not otherwise
specified under a different license shall be put under this license.
Copyright (c) 2023 James Clarke <james@jamesdavidclarke.com>
]]

function modular_computers.motherboard.save_inventory(id)
-- Get the inventory
local inv = modular_computers.motherboard.get_inventory(id)
Expand Down
150 changes: 84 additions & 66 deletions src/items/motherboards/items.lua
Original file line number Diff line number Diff line change
@@ -1,76 +1,94 @@
--[[
This file is part of Modular Computers.
Modular Computers is free software: you can redistribute it and/or modify it under the terms of the
GNU Affero General Public License as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
Modular Computers is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Modular Computers.
If not, see <https://www.gnu.org/licenses/>.
The license is included in the project root under the file labeled LICENSE. All files not otherwise
specified under a different license shall be put under this license.
Copyright (c) 2023 James Clarke <james@jamesdavidclarke.com>
]]

modular_computers.register_motherboard("tier_1", "Tier 1", nil, {
{
{"default", "basic_materials"}, {
{
"default:steel_ingot", "basic_materials:copper_wire",
"default:steel_ingot"
}, {
"basic_materials:copper_wire", "basic_materials:ic",
"basic_materials:copper_wire"
},
{
"default:steel_ingot", "basic_materials:copper_wire",
"default:steel_ingot"
}
{ "default", "basic_materials" }, {
{
"default:steel_ingot", "basic_materials:copper_wire",
"default:steel_ingot"
}, {
"basic_materials:copper_wire", "basic_materials:ic",
"basic_materials:copper_wire"
},
{
"default:steel_ingot", "basic_materials:copper_wire",
"default:steel_ingot"
}
}
}, {
{"default", "mesecons"}, {
{
"default:steel_ingot", "default:copper_ingot",
"default:steel_ingot"
}, {
"default:copper_ingot",
"mesecons_luacontroller:luacontroller0000",
"default:copper_ingot"
},
{
"default:steel_ingot", "default:copper_ingot",
"default:steel_ingot"
}
}
{ "default", "mesecons" }, {
{
"default:steel_ingot", "default:copper_ingot",
"default:steel_ingot"
}, {
{"default"}, {
{
"default:steel_ingot", "default:steel_ingot",
"default:steel_ingot"
},
{
"default:steel_ingot", "default:mese_crystal",
"default:steel_ingot"
},
{
"default:steel_ingot", "default:steel_ingot",
"default:steel_ingot"
}
}
"default:copper_ingot",
"mesecons_luacontroller:luacontroller0000",
"default:copper_ingot"
},
{
"default:steel_ingot", "default:copper_ingot",
"default:steel_ingot"
}
}
}, {
{ "default" }, {
{
"default:steel_ingot", "default:steel_ingot",
"default:steel_ingot"
},
{
"default:steel_ingot", "default:mese_crystal",
"default:steel_ingot"
},
{
"default:steel_ingot", "default:steel_ingot",
"default:steel_ingot"
}
}
}, {
{ "mcl_core" }, {
{
"mcl_core:iron_ingot", "mcl_copper:copper_ingot",
"mcl_core:iron_ingot"
}, {
{"mcl_core"}, {
{
"mcl_core:iron_ingot", "mcl_copper:copper_ingot",
"mcl_core:iron_ingot"
}, {
"mcl_copper:copper_ingot", "mesecons_torch:redstoneblock",
"mcl_copper:copper_ingot"
},
{
"mcl_core:iron_ingot", "mcl_copper:copper_ingot",
"mcl_core:iron_ingot"
}
}
"mcl_copper:copper_ingot", "mesecons_torch:redstoneblock",
"mcl_copper:copper_ingot"
},
{
"mcl_core:iron_ingot", "mcl_copper:copper_ingot",
"mcl_core:iron_ingot"
}
}
}
}, function(id)
return
"size[9,10]" .. "label[3.5,0;" .. modular_computers.S("Motherboard") ..
"]" .. "label[0,1;" .. modular_computers.S("CPU") .. "]" ..
"list[detached:modular_computers:motherboard_inventory_" .. id ..
";cpu;3,1;1,1;]" .. "label[0,2;" .. modular_computers.S("GPU") ..
"]" .. "list[detached:modular_computers:motherboard_inventory_" ..
id .. ";gpu;3,2;1,1;]" .. "label[0,3;" ..
modular_computers.S("Hard Drive") .. "]" ..
"list[detached:modular_computers:motherboard_inventory_" .. id ..
";hdd;3,3;1,1;]" .. "label[0,4;" .. modular_computers.S("USB") ..
"]" .. "list[detached:modular_computers:motherboard_inventory_" ..
id .. ";usb;3,4;1,1;]" .. "list[current_player;main;0,5;9,1;]" ..
"list[current_player;main;0,6.2;9,3;9]" .. "listring[]"

"size[9,10]" ..
"label[3.5,0;" .. modular_computers.S("Motherboard") .. "]" ..
"label[0,1;" .. modular_computers.S("CPU") .. "]" ..
"list[detached:modular_computers:motherboard_inventory_" .. id .. ";cpu;3,1;1,1;]" ..
"label[0,2;" .. modular_computers.S("GPU") .. "]" ..
"list[detached:modular_computers:motherboard_inventory_" .. id .. ";gpu;3,2;1,1;]" ..
"label[0,3;" .. modular_computers.S("Hard Drive") .. "]" ..
"list[detached:modular_computers:motherboard_inventory_" .. id .. ";hdd;3,3;1,1;]" ..
"label[0,4;" .. modular_computers.S("USB") .. "]" ..
"list[detached:modular_computers:motherboard_inventory_" .. id .. ";usb;3,4;1,1;]" ..
"list[current_player;main;0,5;9,1;]" ..
"list[current_player;main;0,6.2;9,3;9]" ..
"listring[]"
end, 1)
18 changes: 18 additions & 0 deletions src/items/motherboards/register.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
--[[
This file is part of Modular Computers.
Modular Computers is free software: you can redistribute it and/or modify it under the terms of the
GNU Affero General Public License as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
Modular Computers is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Modular Computers.
If not, see <https://www.gnu.org/licenses/>.
The license is included in the project root under the file labeled LICENSE. All files not otherwise
specified under a different license shall be put under this license.
Copyright (c) 2023 James Clarke <james@jamesdavidclarke.com>
]]

function modular_computers.register_motherboard(item_name, item_description,
item_image, item_recipes,
formspec, tier_number)
Expand Down
18 changes: 18 additions & 0 deletions src/items/motherboards/utilities.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
--[[
This file is part of Modular Computers.
Modular Computers is free software: you can redistribute it and/or modify it under the terms of the
GNU Affero General Public License as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
Modular Computers is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Modular Computers.
If not, see <https://www.gnu.org/licenses/>.
The license is included in the project root under the file labeled LICENSE. All files not otherwise
specified under a different license shall be put under this license.
Copyright (c) 2023 James Clarke <james@jamesdavidclarke.com>
]]

function modular_computers.motherboard.get_itemstack_from_id(id)
modular_computers:act("Checking existence for id: " .. tostring(id))

Expand Down
Loading

0 comments on commit bd7fd4c

Please sign in to comment.