u
This commit is contained in:
parent
4263d2e987
commit
28925ec062
9 changed files with 278 additions and 274 deletions
76
init.lua
76
init.lua
|
|
@ -1,5 +1,5 @@
|
||||||
--------------------------------------------------------
|
--------------------------------------------------------
|
||||||
-- Minetest :: Generic Flags Mod (flags)
|
-- Minetest :: Pirate Flags Mod (flags)
|
||||||
--
|
--
|
||||||
-- See README.txt for licensing and other information.
|
-- See README.txt for licensing and other information.
|
||||||
-- Made by AwesomeDragon97, Anonymous with code from Wuzzy.
|
-- Made by AwesomeDragon97, Anonymous with code from Wuzzy.
|
||||||
|
|
@ -25,30 +25,34 @@ local rad_90 = pi / 2
|
||||||
local DEFAULT_FLAG = minetest.settings:get('default_flag') or 'white'
|
local DEFAULT_FLAG = minetest.settings:get('default_flag') or 'white'
|
||||||
|
|
||||||
local flag_list = {}
|
local flag_list = {}
|
||||||
if minetest.settings:get_bool('name_flags', true) == true then
|
if minetest.settings:get_bool('color_flags', true) == true then
|
||||||
flag_list = { -- generic flags
|
flag_list = { -- generic flags
|
||||||
"white",
|
"white",
|
||||||
-- "red",
|
"red",
|
||||||
-- "green",
|
"green",
|
||||||
-- "brown",
|
"brown",
|
||||||
-- "blue",
|
"blue",
|
||||||
"black",
|
"black",
|
||||||
-- "orange",
|
"orange",
|
||||||
-- "yellow",
|
"yellow",
|
||||||
-- "purple",
|
"purple",
|
||||||
-- "pink",
|
"pink",
|
||||||
-- "gray",
|
"gray",
|
||||||
-- "cyan",
|
"cyan",
|
||||||
-- "magenta",
|
"magenta",
|
||||||
"dark_green",
|
"dark_green",
|
||||||
"dark_gray",
|
"dark_gray",
|
||||||
"pirate",
|
"pirate", -- non generic
|
||||||
"anarcho",
|
"anarcho",
|
||||||
"makhno",
|
"makhno",
|
||||||
"anonymous",
|
"anonymous",
|
||||||
"guyfox",
|
"guyfox",
|
||||||
"jollyroger",
|
"jollyroger",
|
||||||
"anarchy" }
|
"anarchy",
|
||||||
|
"piratepix",
|
||||||
|
"unso",
|
||||||
|
"una-unso"
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local next_flag, prev_flag
|
local next_flag, prev_flag
|
||||||
|
|
@ -97,7 +101,7 @@ end
|
||||||
local delete_if_orphan = function( self )
|
local delete_if_orphan = function( self )
|
||||||
local pos = self.object:get_pos( )
|
local pos = self.object:get_pos( )
|
||||||
local node = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})
|
local node = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})
|
||||||
if node.name ~= "pirate_flag:upper_mast" and node.name ~= "ignore" then
|
if node.name ~= "pirate_flags_plus:upper_mast" and node.name ~= "ignore" then
|
||||||
minetest.log("action", "[flags] Orphan flag entity removed at "..minetest.pos_to_string(pos, 1))
|
minetest.log("action", "[flags] Orphan flag entity removed at "..minetest.pos_to_string(pos, 1))
|
||||||
self.object:remove( )
|
self.object:remove( )
|
||||||
return true
|
return true
|
||||||
|
|
@ -105,7 +109,7 @@ local delete_if_orphan = function( self )
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_entity( "pirate_flag:wavingflag", {
|
minetest.register_entity( "pirate_flags_plus:wavingflag", {
|
||||||
initial_properties = {
|
initial_properties = {
|
||||||
physical = false,
|
physical = false,
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
|
|
@ -152,7 +156,7 @@ minetest.register_entity( "pirate_flag:wavingflag", {
|
||||||
for o=1, #objs do
|
for o=1, #objs do
|
||||||
local obj = objs[o]
|
local obj = objs[o]
|
||||||
local lua = obj:get_luaentity( )
|
local lua = obj:get_luaentity( )
|
||||||
if lua and self ~= lua and lua.name == "pirate_flag:wavingflag" then
|
if lua and self ~= lua and lua.name == "pirate_flags_plus:wavingflag" then
|
||||||
if lua.node_idx == self.node_idx then
|
if lua.node_idx == self.node_idx then
|
||||||
self.object:remove( )
|
self.object:remove( )
|
||||||
return
|
return
|
||||||
|
|
@ -244,7 +248,7 @@ if minetest.get_modpath("default") ~= nil then
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("pirate_flag:lower_mast", {
|
minetest.register_node("pirate_flags_plus:lower_mast", {
|
||||||
description = ("Flag Pole"),
|
description = ("Flag Pole"),
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
|
@ -303,7 +307,7 @@ local function spawn_flag( pos )
|
||||||
local param2 = minetest.get_node( pos ).param2
|
local param2 = minetest.get_node( pos ).param2
|
||||||
|
|
||||||
local flag_pos = get_flag_pos( pos, param2 )
|
local flag_pos = get_flag_pos( pos, param2 )
|
||||||
local obj = minetest.add_entity( flag_pos, "pirate_flag:wavingflag" )
|
local obj = minetest.add_entity( flag_pos, "pirate_flags_plus:wavingflag" )
|
||||||
if not obj or not obj:get_luaentity( ) then
|
if not obj or not obj:get_luaentity( ) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
@ -359,7 +363,7 @@ local function cycle_flag( pos, player, cycle_backwards )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node( "pirate_flag:upper_mast", {
|
minetest.register_node( "pirate_flags_plus:upper_mast", {
|
||||||
description = ("Flag Pole with Flag"),
|
description = ("Flag Pole with Flag"),
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
|
@ -372,7 +376,7 @@ minetest.register_node( "pirate_flag:upper_mast", {
|
||||||
sounds = metal_sounds,
|
sounds = metal_sounds,
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
|
|
||||||
drop = {"pirate_flag:lower_mast 2", "pirate_flag:upper_mast"},
|
drop = {"pirate_flags_plus:lower_mast 2", "pirate_flags_plus:upper_mast"},
|
||||||
|
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
|
|
@ -400,7 +404,7 @@ minetest.register_node( "pirate_flag:upper_mast", {
|
||||||
|
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
local node2 = minetest.get_node(pointed_thing.under - vector.new(0, 1, 0))
|
local node2 = minetest.get_node(pointed_thing.under - vector.new(0, 1, 0))
|
||||||
if (node.name ~= "pirate_flag:lower_mast" or node2.name ~= "pirate_flag:lower_mast") then
|
if (node.name ~= "pirate_flags_plus:lower_mast" or node2.name ~= "pirate_flags_plus:lower_mast") then
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -417,14 +421,14 @@ minetest.register_node( "pirate_flag:upper_mast", {
|
||||||
local yaw = placer:get_look_horizontal()
|
local yaw = placer:get_look_horizontal()
|
||||||
local dir = minetest.yaw_to_dir(yaw)
|
local dir = minetest.yaw_to_dir(yaw)
|
||||||
local param2 = (minetest.dir_to_facedir(dir) + 3) % 4
|
local param2 = (minetest.dir_to_facedir(dir) + 3) % 4
|
||||||
minetest.set_node(pointed_thing.under - vector.new(0, 1, 0), {name = "pirate_flag:upper_mast", param2 = param2 })
|
minetest.set_node(pointed_thing.under - vector.new(0, 1, 0), {name = "pirate_flags_plus:upper_mast", param2 = param2 })
|
||||||
minetest.set_node(pointed_thing.under, {name = "pirate_flag:upper_mast_hidden_1"})
|
minetest.set_node(pointed_thing.under, {name = "pirate_flags_plus:upper_mast_hidden_1"})
|
||||||
|
|
||||||
if not (minetest.is_creative_enabled(pn)) then
|
if not (minetest.is_creative_enabled(pn)) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
|
|
||||||
local def = minetest.registered_nodes["pirate_flag:upper_mast"]
|
local def = minetest.registered_nodes["pirate_flags_plus:upper_mast"]
|
||||||
if def and def.sounds then
|
if def and def.sounds then
|
||||||
minetest.sound_play(def.sounds.place, {pos = pos}, true)
|
minetest.sound_play(def.sounds.place, {pos = pos}, true)
|
||||||
end
|
end
|
||||||
|
|
@ -449,7 +453,7 @@ minetest.register_node( "pirate_flag:upper_mast", {
|
||||||
|
|
||||||
after_destruct = function( pos )
|
after_destruct = function( pos )
|
||||||
local above1 = {x=pos.x, y=pos.y+1, z=pos.z}
|
local above1 = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||||
if minetest.get_node( above1 ).name == "pirate_flag:upper_mast_hidden_1" then
|
if minetest.get_node( above1 ).name == "pirate_flags_plus:upper_mast_hidden_1" then
|
||||||
minetest.remove_node( above1 )
|
minetest.remove_node( above1 )
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
@ -481,9 +485,9 @@ minetest.register_node( "pirate_flag:upper_mast", {
|
||||||
} )
|
} )
|
||||||
|
|
||||||
minetest.register_lbm({
|
minetest.register_lbm({
|
||||||
name = "pirate_flag:respawn_flags",
|
name = "pirate_flags_plus:respawn_flags",
|
||||||
label = "Respawn flags",
|
label = "Respawn flags",
|
||||||
nodenames = {"pirate_flag:upper_mast"},
|
nodenames = {"pirate_flags_plus:upper_mast"},
|
||||||
run_at_every_load = true,
|
run_at_every_load = true,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
local node_idx = minetest.hash_node_position( pos )
|
local node_idx = minetest.hash_node_position( pos )
|
||||||
|
|
@ -496,9 +500,9 @@ minetest.register_lbm({
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_lbm({
|
minetest.register_lbm({
|
||||||
name = "pirate_flag:update_node_meta",
|
name = "pirate_flags_plus:update_node_meta",
|
||||||
label = "Update mast node meta",
|
label = "Update mast node meta",
|
||||||
nodenames = {"pirate_flag:upper_mast"},
|
nodenames = {"pirate_flags_plus:upper_mast"},
|
||||||
run_at_every_load = false,
|
run_at_every_load = false,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
local meta = minetest.get_meta( pos )
|
local meta = minetest.get_meta( pos )
|
||||||
|
|
@ -515,7 +519,7 @@ local flagpole_material = minetest.settings:get('flagpole_material') or "default
|
||||||
|
|
||||||
if minetest.registered_items[flagpole_material] then
|
if minetest.registered_items[flagpole_material] then
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "pirate_flag:lower_mast 3",
|
output = "pirate_flags_plus:lower_mast 3",
|
||||||
recipe = {
|
recipe = {
|
||||||
{flagpole_material},
|
{flagpole_material},
|
||||||
{flagpole_material},
|
{flagpole_material},
|
||||||
|
|
@ -524,7 +528,7 @@ if minetest.registered_items[flagpole_material] then
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "pirate_flag:upper_mast",
|
output = "pirate_flags_plus:upper_mast",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:wool", "group:wool", "group:wool"},
|
{"group:wool", "group:wool", "group:wool"},
|
||||||
{"group:wool", "group:wool", "group:wool"},
|
{"group:wool", "group:wool", "group:wool"},
|
||||||
|
|
@ -537,7 +541,7 @@ minetest.register_craft({
|
||||||
-- This node will be automatically
|
-- This node will be automatically
|
||||||
-- added/removed when the upper mast is constructed
|
-- added/removed when the upper mast is constructed
|
||||||
-- or destructed.
|
-- or destructed.
|
||||||
minetest.register_node( "pirate_flag:upper_mast_hidden_1", {
|
minetest.register_node( "pirate_flags_plus:upper_mast_hidden_1", {
|
||||||
drawtype = "airlike",
|
drawtype = "airlike",
|
||||||
pointable = false,
|
pointable = false,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
|
@ -574,7 +578,7 @@ end
|
||||||
|
|
||||||
flags.set_flag_at = function( pos, flag_name )
|
flags.set_flag_at = function( pos, flag_name )
|
||||||
local node = minetest.get_node( pos )
|
local node = minetest.get_node( pos )
|
||||||
if node.name ~= "pirate_flag:upper_mast" then
|
if node.name ~= "pirate_flags_plus:upper_mast" then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if not flag_exists( flag_name ) then
|
if not flag_exists( flag_name ) then
|
||||||
|
|
@ -599,7 +603,7 @@ end
|
||||||
|
|
||||||
flags.get_flag_at = function( pos )
|
flags.get_flag_at = function( pos )
|
||||||
local node = minetest.get_node( pos )
|
local node = minetest.get_node( pos )
|
||||||
if node.name ~= "pirate_flag:upper_mast" then
|
if node.name ~= "pirate_flags_plus:upper_mast" then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
local meta = minetest.get_meta( pos )
|
local meta = minetest.get_meta( pos )
|
||||||
|
|
|
||||||
6
mod.conf
6
mod.conf
|
|
@ -1,6 +1,6 @@
|
||||||
name = pirate_flag
|
name = pirate_flags_plus
|
||||||
title = Pirate Flags
|
title = Pirate Flags Plus
|
||||||
author = Anonymous
|
author = Anonymous
|
||||||
optional_depends = default, screwdriver
|
optional_depends = default, screwdriver
|
||||||
description = Seven flags based on Generic flags
|
description = Adds a variety of generic animated flags. Original mod is by Wuzzy. Feel free to extend this mod with your own flags. All of my modifications to the original mod are also LGPL-3.
|
||||||
|
|
||||||
|
|
|
||||||
BIN
models/.DS_Store
vendored
Normal file
BIN
models/.DS_Store
vendored
Normal file
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
name_flags (Enable types flags) bool true
|
color_flags (Enable single color flags) bool true
|
||||||
|
|
||||||
default_flag (Default flag) string white
|
default_flag (Default flag) string white
|
||||||
|
|
||||||
|
|
|
||||||
BIN
textures/flag_piratepix.png
Normal file
BIN
textures/flag_piratepix.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
BIN
textures/flag_una-unso.png
Normal file
BIN
textures/flag_una-unso.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 146 KiB |
BIN
textures/flag_unso.png
Normal file
BIN
textures/flag_unso.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
Loading…
Add table
Add a link
Reference in a new issue