Add files via upload

This commit is contained in:
loosewheel
2021-11-24 19:33:57 +10:00
committed by GitHub
parent bd75cddfc8
commit 61825c93af
9 changed files with 1115 additions and 6 deletions

1021
cannon.lua Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -58,3 +58,7 @@ v0.1.8
v0.1.9
* Fixed infotext on various nodes.
v0.1.10
* Added cannons.

View File

@@ -3,6 +3,27 @@ local S = utils.S
minetest.register_craft( {
output = "lwcomponents:cannon",
recipe = {
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
{ "default:chest", "default:wood", "" },
{ "default:copper_ingot", "default:stone", "" },
},
})
minetest.register_craft( {
output = "lwcomponents:cannon_locked",
recipe = {
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
{ "default:chest_locked", "default:wood", "" },
{ "default:copper_ingot", "default:stone", "" },
},
})
if utils.digilines_supported or utils.mesecon_supported then
minetest.register_craft( {

View File

@@ -158,11 +158,12 @@ local function dispense_item (pos, node, slot)
if not obj then
obj = minetest.add_item (spawn_pos, item)
obj:set_velocity (dispense_velocity (node))
if obj then
obj:set_velocity (dispense_velocity (node))
end
end
if obj then
stack:set_count (stack:get_count () - 1)
inv:set_stack ("main", slot, stack)

View File

@@ -1,4 +1,4 @@
local version = "0.1.9"
local version = "0.1.10"
local mod_storage = minetest.get_mod_storage ()
@@ -31,6 +31,7 @@ loadfile (modpath.."/breaker.lua") (utils)
loadfile (modpath.."/deployer.lua") (utils)
loadfile (modpath.."/fan.lua") (utils)
loadfile (modpath.."/conduit.lua") (utils, mod_storage)
loadfile (modpath.."/cannon.lua") (utils)
loadfile (modpath.."/extras.lua") (utils)
loadfile (modpath.."/digiswitch.lua") (utils)
loadfile (modpath.."/movefloor.lua") (utils)

View File

@@ -69,6 +69,8 @@ public domain.
player button images derived from mesecons button image.
cannon firing sound from tnt, released under CC BY-SA 3.0 and CC0 1.0
All other media, or media not covered by a licence, is licensed
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)

View File

@@ -13,7 +13,7 @@ CC BY-SA 3.0
Version
=======
0.1.9
0.1.10
Minetest Version
@@ -63,6 +63,7 @@ Various components for mesecons and digilines.
* Hologram, projects a hologram above the hologram node.
* Fan, blows any entity, player or drop in front of the fan.
* Conduit, connected in a circuit to move items.
* Cannons, shots an item on command with directional aiming.
* Digiswitch, digilines controlled mesecons power.
* Movefloor, similar to vertical mesecons movestone.
* Solid color conductor blocks, same as Solid Color Block but also mesecons
@@ -84,7 +85,7 @@ the relevant mod is loaded.
The mod supports the following settings:
Spawn mobs
Allow dispensers to spawn mobs instead of spawners.
Allow dispensers and cannons to spawn mobs instead of spawners.
Default: true
Alert handler errors

View File

@@ -1,4 +1,4 @@
# Allow dispensers to spawn mobs instead of spawners.
# Allow dispensers and cannons to spawn mobs instead of spawners.
lwcomponents_spawn_mobs (Spawn mobs) bool true
# Issue errors when handler's of other mods fail.

View File

@@ -271,4 +271,62 @@ end
function utils.can_place (pos)
local node = minetest.get_node_or_nil (pos)
if node and node.name ~= "air" then
local def = minetest.registered_nodes[node.name]
if not def or not def.buildable_to then
return false
end
end
return true
end
function utils.is_protected (pos, player)
local name = (player and player:get_player_name ()) or ""
return minetest.is_protected (pos, name)
end
function utils.get_on_rightclick (pos, player)
local node = minetest.get_node_or_nil (pos)
if node then
local def = minetest.registered_nodes[node.name]
if def and def.on_rightclick and
not (player and player:is_player () and
player:get_player_control ().sneak) then
return def.on_rightclick
end
end
return nil
end
function utils.is_creative (player)
if minetest.settings:get_bool ("creative_mode") then
return true
end
if player and player:is_player () then
return minetest.is_creative_enabled (player:get_player_name ()) or
minetest.check_player_privs (placer, "creative")
end
return false
end
--