fix public anvil support
This commit is contained in:
parent
1fe8fb84c2
commit
cdbc22b9dc
650
.luacheckrc
650
.luacheckrc
|
@ -5,19 +5,643 @@ max_line_length = 120
|
||||||
stds.minetest = {
|
stds.minetest = {
|
||||||
read_globals = {
|
read_globals = {
|
||||||
"DIR_DELIM",
|
"DIR_DELIM",
|
||||||
"minetest",
|
"dump",
|
||||||
"core",
|
"dump2",
|
||||||
"dump",
|
|
||||||
"vector",
|
math = {
|
||||||
"nodeupdate",
|
fields = {
|
||||||
"VoxelManip",
|
abs = {},
|
||||||
"VoxelArea",
|
acos = {},
|
||||||
"PseudoRandom",
|
asin = {},
|
||||||
"ItemStack",
|
atan = {},
|
||||||
"default",
|
atan2 = {},
|
||||||
"table",
|
ceil = {},
|
||||||
"math",
|
cos = {},
|
||||||
"string",
|
cosh = {},
|
||||||
|
deg = {},
|
||||||
|
exp = {},
|
||||||
|
factorial = {},
|
||||||
|
floor = {},
|
||||||
|
fmod = {},
|
||||||
|
frexp = {},
|
||||||
|
huge = {},
|
||||||
|
hypot = {},
|
||||||
|
ldexp = {},
|
||||||
|
log = {},
|
||||||
|
log10 = {},
|
||||||
|
max = {},
|
||||||
|
min = {},
|
||||||
|
modf = {},
|
||||||
|
pi = {},
|
||||||
|
pow = {},
|
||||||
|
rad = {},
|
||||||
|
random = {},
|
||||||
|
randomseed = {},
|
||||||
|
round = {},
|
||||||
|
sign = {},
|
||||||
|
sin = {},
|
||||||
|
sinh = {},
|
||||||
|
sqrt = {},
|
||||||
|
tan = {},
|
||||||
|
tanh = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
table = {
|
||||||
|
fields = {
|
||||||
|
copy = {},
|
||||||
|
concat = {},
|
||||||
|
foreach = {},
|
||||||
|
foreachi = {},
|
||||||
|
getn = {},
|
||||||
|
indexof = {},
|
||||||
|
insert = {},
|
||||||
|
insert_all = {},
|
||||||
|
key_value_swap = {},
|
||||||
|
maxn = {},
|
||||||
|
move = {},
|
||||||
|
remove = {},
|
||||||
|
shuffle = {},
|
||||||
|
sort = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
string = {
|
||||||
|
fields = {
|
||||||
|
byte = {},
|
||||||
|
char = {},
|
||||||
|
dump = {},
|
||||||
|
find = {},
|
||||||
|
format = {},
|
||||||
|
gmatch = {},
|
||||||
|
len = {},
|
||||||
|
lower = {},
|
||||||
|
match = {},
|
||||||
|
rep = {},
|
||||||
|
reverse = {},
|
||||||
|
split = {},
|
||||||
|
sub = {},
|
||||||
|
trim = {},
|
||||||
|
upper = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
vector = {
|
||||||
|
fields = {
|
||||||
|
add = {},
|
||||||
|
angle = {},
|
||||||
|
apply = {},
|
||||||
|
check = {},
|
||||||
|
combine = {},
|
||||||
|
copy = {},
|
||||||
|
cross = {},
|
||||||
|
dir_to_rotation = {},
|
||||||
|
direction = {},
|
||||||
|
distance = {},
|
||||||
|
divide = {},
|
||||||
|
dot = {},
|
||||||
|
equals = {},
|
||||||
|
floor = {},
|
||||||
|
from_string = {},
|
||||||
|
length = {},
|
||||||
|
metatable = {},
|
||||||
|
multiply = {},
|
||||||
|
new = {},
|
||||||
|
normalize = {},
|
||||||
|
offset = {},
|
||||||
|
rotate = {},
|
||||||
|
rotate_around_axis = {},
|
||||||
|
round = {},
|
||||||
|
sort = {},
|
||||||
|
subtract = {},
|
||||||
|
to_string = {},
|
||||||
|
zero = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
ItemStack = {
|
||||||
|
fields = {
|
||||||
|
add_item = {},
|
||||||
|
add_wear = {},
|
||||||
|
add_wear_by_uses = {},
|
||||||
|
clear = {},
|
||||||
|
get_count = {},
|
||||||
|
get_definition = {},
|
||||||
|
get_description = {},
|
||||||
|
get_free_space = {},
|
||||||
|
get_meta = {},
|
||||||
|
get_metadata = {},
|
||||||
|
get_name = {},
|
||||||
|
get_short_description = {},
|
||||||
|
get_stack_max = {},
|
||||||
|
get_tool_capabilities = {},
|
||||||
|
get_wear = {},
|
||||||
|
is_empty = {},
|
||||||
|
is_known = {},
|
||||||
|
item_fits = {},
|
||||||
|
peek_item = {},
|
||||||
|
replace = {},
|
||||||
|
set_count = {},
|
||||||
|
set_metadata = {},
|
||||||
|
set_name = {},
|
||||||
|
set_wear = {},
|
||||||
|
take_item = {},
|
||||||
|
to_string = {},
|
||||||
|
to_table = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
PerlinNoise = {
|
||||||
|
fields = {
|
||||||
|
get_2d = {},
|
||||||
|
get_3d = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
PerlinNoiseMap = {
|
||||||
|
fields = {
|
||||||
|
calc_2d_map = {},
|
||||||
|
calc_3d_map = {},
|
||||||
|
get_2d_map = {},
|
||||||
|
get_2d_map_flat = {},
|
||||||
|
get_3d_map = {},
|
||||||
|
get_3d_map_flat = {},
|
||||||
|
get_map_slice = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
PseudoRandom = {
|
||||||
|
fields = {
|
||||||
|
next = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
PcgRandom = {
|
||||||
|
fields = {
|
||||||
|
next = {},
|
||||||
|
rand_normal_dist = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
SecureRandom = {
|
||||||
|
fields = {
|
||||||
|
next_bytes = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Settings = {
|
||||||
|
fields = {
|
||||||
|
get = {},
|
||||||
|
get_bool = {},
|
||||||
|
get_flags = {},
|
||||||
|
get_names = {},
|
||||||
|
get_np_group = {},
|
||||||
|
remove = {},
|
||||||
|
set = {},
|
||||||
|
set_bool = {},
|
||||||
|
set_np_group = {},
|
||||||
|
to_table = {},
|
||||||
|
write = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
VoxelArea = {
|
||||||
|
fields = {
|
||||||
|
MaxEdge = {},
|
||||||
|
MinEdge = {},
|
||||||
|
contains = {},
|
||||||
|
containsi = {},
|
||||||
|
containsp = {},
|
||||||
|
getExtent = {},
|
||||||
|
getVolume = {},
|
||||||
|
index = {},
|
||||||
|
indexp = {},
|
||||||
|
iter = {},
|
||||||
|
iterp = {},
|
||||||
|
new = {},
|
||||||
|
position = {},
|
||||||
|
ystride = {},
|
||||||
|
zstride = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
VoxelManip = {
|
||||||
|
fields = {
|
||||||
|
calc_lighting = {},
|
||||||
|
get_data = {},
|
||||||
|
get_emerged_area = {},
|
||||||
|
get_light_data = {},
|
||||||
|
get_node_at = {},
|
||||||
|
get_param2_data = {},
|
||||||
|
read_from_map = {},
|
||||||
|
set_data = {},
|
||||||
|
set_light_data = {},
|
||||||
|
set_lighting = {},
|
||||||
|
set_node_at = {},
|
||||||
|
set_param2_data = {},
|
||||||
|
update_liquids = {},
|
||||||
|
update_map = {},
|
||||||
|
was_modified = {},
|
||||||
|
write_to_map = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
minetest = {
|
||||||
|
fields = {
|
||||||
|
CONTENT_AIR = {},
|
||||||
|
CONTENT_IGNORE = {},
|
||||||
|
CONTENT_UNKNOWN = {},
|
||||||
|
EMERGE_CANCELLED = {},
|
||||||
|
EMERGE_ERRORED = {},
|
||||||
|
EMERGE_FROM_DISK = {},
|
||||||
|
EMERGE_FROM_MEMORY = {},
|
||||||
|
EMERGE_GENERATED = {},
|
||||||
|
LIGHT_MAX = {},
|
||||||
|
MAP_BLOCKSIZE = {},
|
||||||
|
PLAYER_MAX_BREATH_DEFAULT = {},
|
||||||
|
PLAYER_MAX_HP_DEFAULT = {},
|
||||||
|
add_entity = {},
|
||||||
|
add_item = {},
|
||||||
|
add_node = {},
|
||||||
|
add_node_level = {},
|
||||||
|
add_particle = {},
|
||||||
|
add_particlespawner = {},
|
||||||
|
after = {},
|
||||||
|
async_event_handler = {},
|
||||||
|
async_jobs = {},
|
||||||
|
auth_reload = {},
|
||||||
|
ban_player = {},
|
||||||
|
builtin_auth_handler = {},
|
||||||
|
bulk_set_node = {},
|
||||||
|
calculate_knockback = {},
|
||||||
|
callback_origins = {},
|
||||||
|
cancel_shutdown_requests = {},
|
||||||
|
chat_send_all = {},
|
||||||
|
chat_send_player = {},
|
||||||
|
chatcommands = {},
|
||||||
|
check_for_falling = {},
|
||||||
|
check_password_entry = {},
|
||||||
|
check_player_privs = {},
|
||||||
|
check_single_for_falling = {},
|
||||||
|
clear_craft = {},
|
||||||
|
clear_objects = {},
|
||||||
|
clear_registered_biomes = {},
|
||||||
|
clear_registered_decorations = {},
|
||||||
|
clear_registered_ores = {},
|
||||||
|
clear_registered_schematics = {},
|
||||||
|
close_formspec = {},
|
||||||
|
colorize = {},
|
||||||
|
colorspec_to_bytes = {},
|
||||||
|
colorspec_to_colorstring = {},
|
||||||
|
compare_block_status = {},
|
||||||
|
compress = {},
|
||||||
|
cpdir = {},
|
||||||
|
craft_predict = {},
|
||||||
|
craftitemdef_default = {},
|
||||||
|
create_detached_inventory = {},
|
||||||
|
create_detached_inventory_raw = {},
|
||||||
|
create_schematic = {},
|
||||||
|
debug = {},
|
||||||
|
decode_base64 = {},
|
||||||
|
decompress = {},
|
||||||
|
delete_area = {},
|
||||||
|
delete_particlespawner = {},
|
||||||
|
deserialize = {},
|
||||||
|
detached_inventories = {},
|
||||||
|
dig_node = {},
|
||||||
|
dir_to_facedir = {},
|
||||||
|
dir_to_wallmounted = {},
|
||||||
|
dir_to_yaw = {},
|
||||||
|
disconnect_player = {},
|
||||||
|
do_async_callback = {},
|
||||||
|
do_item_eat = {},
|
||||||
|
dynamic_add_media = {},
|
||||||
|
dynamic_media_callbacks = {},
|
||||||
|
emerge_area = {},
|
||||||
|
encode_base64 = {},
|
||||||
|
encode_png = {},
|
||||||
|
env = {},
|
||||||
|
explode_scrollbar_event = {},
|
||||||
|
explode_table_event = {},
|
||||||
|
explode_textlist_event = {},
|
||||||
|
facedir_to_dir = {},
|
||||||
|
features = {},
|
||||||
|
find_node_near = {},
|
||||||
|
find_nodes_in_area = {},
|
||||||
|
find_nodes_in_area_under_air = {},
|
||||||
|
find_nodes_with_meta = {},
|
||||||
|
find_path = {},
|
||||||
|
fix_light = {},
|
||||||
|
forceload_block = {},
|
||||||
|
forceload_free_block = {},
|
||||||
|
format_chat_message = {},
|
||||||
|
formspec_escape = {},
|
||||||
|
generate_decorations = {},
|
||||||
|
generate_ores = {},
|
||||||
|
get_all_craft_recipes = {},
|
||||||
|
get_artificial_light = {},
|
||||||
|
get_auth_handler = {},
|
||||||
|
get_background_escape_sequence = {},
|
||||||
|
get_ban_description = {},
|
||||||
|
get_ban_list = {},
|
||||||
|
get_biome_data = {},
|
||||||
|
get_biome_id = {},
|
||||||
|
get_biome_name = {},
|
||||||
|
get_builtin_path = {},
|
||||||
|
get_color_escape_sequence = {},
|
||||||
|
get_connected_players = {},
|
||||||
|
get_content_id = {},
|
||||||
|
get_craft_recipe = {},
|
||||||
|
get_craft_result = {},
|
||||||
|
get_current_modname = {},
|
||||||
|
get_day_count = {},
|
||||||
|
get_decoration_id = {},
|
||||||
|
get_dig_params = {},
|
||||||
|
get_dir_list = {},
|
||||||
|
get_gametime = {},
|
||||||
|
get_gen_notify = {},
|
||||||
|
get_heat = {},
|
||||||
|
get_hit_params = {},
|
||||||
|
get_humidity = {},
|
||||||
|
get_inventory = {},
|
||||||
|
get_item_group = {},
|
||||||
|
get_last_run_mod = {},
|
||||||
|
get_mapgen_object = {},
|
||||||
|
get_mapgen_params = {},
|
||||||
|
get_mapgen_setting = {},
|
||||||
|
get_mapgen_setting_noiseparams = {},
|
||||||
|
get_meta = {},
|
||||||
|
get_mod_storage = {},
|
||||||
|
get_modnames = {},
|
||||||
|
get_modpath = {},
|
||||||
|
get_name_from_content_id = {},
|
||||||
|
get_natural_light = {},
|
||||||
|
get_node = {},
|
||||||
|
get_node_drops = {},
|
||||||
|
get_node_group = {},
|
||||||
|
get_node_level = {},
|
||||||
|
get_node_light = {},
|
||||||
|
get_node_max_level = {},
|
||||||
|
get_node_or_nil = {},
|
||||||
|
get_node_timer = {},
|
||||||
|
get_noiseparams = {},
|
||||||
|
get_objects_in_area = {},
|
||||||
|
get_objects_inside_radius = {},
|
||||||
|
get_password_hash = {},
|
||||||
|
get_perlin = {},
|
||||||
|
get_perlin_map = {},
|
||||||
|
get_player_by_name = {},
|
||||||
|
get_player_information = {},
|
||||||
|
get_player_ip = {},
|
||||||
|
get_player_privs = {},
|
||||||
|
get_player_radius_area = {},
|
||||||
|
get_pointed_thing_position = {},
|
||||||
|
get_position_from_hash = {},
|
||||||
|
get_server_max_lag = {},
|
||||||
|
get_server_status = {},
|
||||||
|
get_server_uptime = {},
|
||||||
|
get_spawn_level = {},
|
||||||
|
get_timeofday = {},
|
||||||
|
get_tool_wear_after_use = {},
|
||||||
|
get_translated_string = {},
|
||||||
|
get_translator = {},
|
||||||
|
get_us_time = {},
|
||||||
|
get_user_path = {},
|
||||||
|
get_version = {},
|
||||||
|
get_voxel_manip = {},
|
||||||
|
get_worldpath = {},
|
||||||
|
global_exists = {},
|
||||||
|
handle_async = {},
|
||||||
|
handle_node_drops = {},
|
||||||
|
has_feature = {},
|
||||||
|
hash_node_position = {},
|
||||||
|
hud_replace_builtin = {},
|
||||||
|
inventorycube = {},
|
||||||
|
is_area_protected = {},
|
||||||
|
is_colored_paramtype = {},
|
||||||
|
is_creative_enabled = {},
|
||||||
|
is_nan = {},
|
||||||
|
is_player = {},
|
||||||
|
is_protected = {},
|
||||||
|
is_singleplayer = {},
|
||||||
|
is_yes = {},
|
||||||
|
item_drop = {},
|
||||||
|
item_eat = {},
|
||||||
|
item_place = {},
|
||||||
|
item_place_node = {},
|
||||||
|
item_place_object = {},
|
||||||
|
item_secondary_use = {},
|
||||||
|
itemstring_with_color = {},
|
||||||
|
itemstring_with_palette = {},
|
||||||
|
kick_player = {},
|
||||||
|
line_of_sight = {},
|
||||||
|
load_area = {},
|
||||||
|
log = {},
|
||||||
|
luaentities = {},
|
||||||
|
mkdir = {},
|
||||||
|
mod_channel_join = {},
|
||||||
|
mvdir = {},
|
||||||
|
node_dig = {},
|
||||||
|
node_punch = {},
|
||||||
|
nodedef_default = {},
|
||||||
|
noneitemdef_default = {},
|
||||||
|
notify_authentication_modified = {},
|
||||||
|
object_refs = {},
|
||||||
|
on_craft = {},
|
||||||
|
override_chatcommand = {},
|
||||||
|
override_item = {},
|
||||||
|
parse_coordinates = {},
|
||||||
|
parse_json = {},
|
||||||
|
parse_relative_number = {},
|
||||||
|
place_node = {},
|
||||||
|
place_schematic = {},
|
||||||
|
place_schematic_on_vmanip = {},
|
||||||
|
player_exists = {},
|
||||||
|
pointed_thing_to_face_pos = {},
|
||||||
|
pos_to_string = {},
|
||||||
|
print = {},
|
||||||
|
privs_to_string = {},
|
||||||
|
punch_node = {},
|
||||||
|
raillike_group = {},
|
||||||
|
raycast = {},
|
||||||
|
read_schematic = {},
|
||||||
|
record_protection_violation = {},
|
||||||
|
register_abm = {},
|
||||||
|
register_alias = {},
|
||||||
|
register_alias_force = {},
|
||||||
|
register_allow_player_inventory_action = {},
|
||||||
|
register_async_dofile = {},
|
||||||
|
register_authentication_handler = {},
|
||||||
|
register_biome = {},
|
||||||
|
register_can_bypass_userlimit = {},
|
||||||
|
register_chatcommand = {},
|
||||||
|
register_craft = {},
|
||||||
|
register_craft_predict = {},
|
||||||
|
register_craftitem = {},
|
||||||
|
register_decoration = {},
|
||||||
|
register_entity = {},
|
||||||
|
register_globalstep = {},
|
||||||
|
register_item = {},
|
||||||
|
register_lbm = {},
|
||||||
|
register_node = {},
|
||||||
|
register_on_auth_fail = {},
|
||||||
|
register_on_authplayer = {},
|
||||||
|
register_on_chat_message = {},
|
||||||
|
register_on_chatcommand = {},
|
||||||
|
register_on_cheat = {},
|
||||||
|
register_on_craft = {},
|
||||||
|
register_on_dieplayer = {},
|
||||||
|
register_on_dignode = {},
|
||||||
|
register_on_generated = {},
|
||||||
|
register_on_item_eat = {},
|
||||||
|
register_on_joinplayer = {},
|
||||||
|
register_on_leaveplayer = {},
|
||||||
|
register_on_liquid_transformed = {},
|
||||||
|
register_on_mapgen_init = {},
|
||||||
|
register_on_modchannel_message = {},
|
||||||
|
register_on_mods_loaded = {},
|
||||||
|
register_on_newplayer = {},
|
||||||
|
register_on_placenode = {},
|
||||||
|
register_on_player_hpchange = {},
|
||||||
|
register_on_player_inventory_action = {},
|
||||||
|
register_on_player_receive_fields = {},
|
||||||
|
register_on_prejoinplayer = {},
|
||||||
|
register_on_priv_grant = {},
|
||||||
|
register_on_priv_revoke = {},
|
||||||
|
register_on_protection_violation = {},
|
||||||
|
register_on_punchnode = {},
|
||||||
|
register_on_punchplayer = {},
|
||||||
|
register_on_respawnplayer = {},
|
||||||
|
register_on_rightclickplayer = {},
|
||||||
|
register_on_shutdown = {},
|
||||||
|
register_ore = {},
|
||||||
|
register_playerevent = {},
|
||||||
|
register_privilege = {},
|
||||||
|
register_schematic = {},
|
||||||
|
register_tool = {},
|
||||||
|
registered_abms = {other_fields = true},
|
||||||
|
registered_aliases = {other_fields = true},
|
||||||
|
registered_allow_player_inventory_actions = {other_fields = true},
|
||||||
|
registered_biomes = {other_fields = true},
|
||||||
|
registered_can_bypass_userlimit = {other_fields = true},
|
||||||
|
registered_chatcommands = {other_fields = true},
|
||||||
|
registered_craft_predicts = {other_fields = true},
|
||||||
|
registered_craftitems = {other_fields = true},
|
||||||
|
registered_decorations = {other_fields = true},
|
||||||
|
registered_entities = {other_fields = true},
|
||||||
|
registered_globalsteps = {other_fields = true},
|
||||||
|
registered_items = {other_fields = true},
|
||||||
|
registered_lbms = {other_fields = true},
|
||||||
|
registered_nodes = {other_fields = true},
|
||||||
|
registered_on_authplayers = {other_fields = true},
|
||||||
|
registered_on_chat_messages = {other_fields = true},
|
||||||
|
registered_on_chatcommands = {other_fields = true},
|
||||||
|
registered_on_cheats = {other_fields = true},
|
||||||
|
registered_on_crafts = {other_fields = true},
|
||||||
|
registered_on_dieplayers = {other_fields = true},
|
||||||
|
registered_on_dignodes = {other_fields = true},
|
||||||
|
registered_on_generateds = {other_fields = true},
|
||||||
|
registered_on_item_eats = {other_fields = true},
|
||||||
|
registered_on_joinplayers = {other_fields = true},
|
||||||
|
registered_on_leaveplayers = {other_fields = true},
|
||||||
|
registered_on_liquid_transformed = {other_fields = true},
|
||||||
|
registered_on_modchannel_message = {other_fields = true},
|
||||||
|
registered_on_mods_loaded = {other_fields = true},
|
||||||
|
registered_on_newplayers = {other_fields = true},
|
||||||
|
registered_on_placenodes = {other_fields = true},
|
||||||
|
registered_on_player_hpchange = {other_fields = true},
|
||||||
|
registered_on_player_hpchanges = {other_fields = true},
|
||||||
|
registered_on_player_inventory_actions = {other_fields = true},
|
||||||
|
registered_on_player_receive_fields = {other_fields = true},
|
||||||
|
registered_on_prejoinplayers = {other_fields = true},
|
||||||
|
registered_on_priv_grant = {other_fields = true},
|
||||||
|
registered_on_priv_revoke = {other_fields = true},
|
||||||
|
registered_on_protection_violation = {other_fields = true},
|
||||||
|
registered_on_punchnodes = {other_fields = true},
|
||||||
|
registered_on_punchplayers = {other_fields = true},
|
||||||
|
registered_on_respawnplayers = {other_fields = true},
|
||||||
|
registered_on_rightclickplayers = {other_fields = true},
|
||||||
|
registered_on_shutdown = {other_fields = true},
|
||||||
|
registered_ores = {other_fields = true},
|
||||||
|
registered_playerevents = {other_fields = true},
|
||||||
|
registered_privileges = {other_fields = true},
|
||||||
|
registered_tools = {other_fields = true},
|
||||||
|
remove_detached_inventory = {},
|
||||||
|
remove_detached_inventory_raw = {},
|
||||||
|
remove_node = {},
|
||||||
|
remove_player = {},
|
||||||
|
remove_player_auth = {},
|
||||||
|
request_http_api = {},
|
||||||
|
request_insecure_environment = {},
|
||||||
|
request_shutdown = {},
|
||||||
|
rgba = {},
|
||||||
|
rmdir = {},
|
||||||
|
rollback_get_last_node_actor = {},
|
||||||
|
rollback_get_node_actions = {},
|
||||||
|
rollback_punch_callbacks = {},
|
||||||
|
rollback_revert_actions_by = {},
|
||||||
|
rotate_and_place = {},
|
||||||
|
rotate_node = {},
|
||||||
|
run_callbacks = {},
|
||||||
|
run_priv_callbacks = {},
|
||||||
|
safe_file_write = {},
|
||||||
|
send_join_message = {},
|
||||||
|
send_leave_message = {},
|
||||||
|
serialize = {},
|
||||||
|
serialize_roundtrip = {},
|
||||||
|
serialize_schematic = {},
|
||||||
|
set_gen_notify = {},
|
||||||
|
set_last_run_mod = {},
|
||||||
|
set_mapgen_params = {},
|
||||||
|
set_mapgen_setting = {},
|
||||||
|
set_mapgen_setting_noiseparams = {},
|
||||||
|
set_node = {},
|
||||||
|
set_node_level = {},
|
||||||
|
set_noiseparams = {},
|
||||||
|
set_player_password = {},
|
||||||
|
set_player_privs = {},
|
||||||
|
set_timeofday = {},
|
||||||
|
setting_get = {},
|
||||||
|
setting_get_pos = {},
|
||||||
|
setting_getbool = {},
|
||||||
|
setting_save = {},
|
||||||
|
setting_set = {},
|
||||||
|
setting_setbool = {},
|
||||||
|
settings = {
|
||||||
|
fields = {
|
||||||
|
get = {},
|
||||||
|
get_bool = {},
|
||||||
|
get_np_group = {},
|
||||||
|
get_flags = {},
|
||||||
|
set = {},
|
||||||
|
set_bool = {},
|
||||||
|
set_np_group = {},
|
||||||
|
remove = {},
|
||||||
|
get_names = {},
|
||||||
|
write = {},
|
||||||
|
to_table = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sha1 = {},
|
||||||
|
show_formspec = {},
|
||||||
|
show_general_help_formspec = {},
|
||||||
|
show_privs_help_formspec = {},
|
||||||
|
sound_fade = {},
|
||||||
|
sound_play = {},
|
||||||
|
sound_stop = {},
|
||||||
|
spawn_falling_node = {},
|
||||||
|
spawn_item = {},
|
||||||
|
spawn_tree = {},
|
||||||
|
string_to_area = {},
|
||||||
|
string_to_pos = {},
|
||||||
|
string_to_privs = {},
|
||||||
|
strip_background_colors = {},
|
||||||
|
strip_colors = {},
|
||||||
|
strip_foreground_colors = {},
|
||||||
|
strip_param2_color = {},
|
||||||
|
swap_node = {},
|
||||||
|
tooldef_default = {},
|
||||||
|
transforming_liquid_add = {},
|
||||||
|
translate = {},
|
||||||
|
unban_player_or_ip = {},
|
||||||
|
unregister_biome = {},
|
||||||
|
unregister_chatcommand = {},
|
||||||
|
unregister_item = {},
|
||||||
|
wallmounted_to_dir = {},
|
||||||
|
wrap_text = {},
|
||||||
|
write_json = {},
|
||||||
|
yaw_to_dir = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ repos:
|
||||||
- id: fix-byte-order-marker
|
- id: fix-byte-order-marker
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
|
|
||||||
- id: mixed-line-ending
|
- id: mixed-line-ending
|
||||||
args: [ --fix=lf ]
|
args: [ --fix=lf ]
|
||||||
|
|
||||||
|
@ -15,5 +14,12 @@ repos:
|
||||||
name: luacheck
|
name: luacheck
|
||||||
language: system
|
language: system
|
||||||
entry: luacheck
|
entry: luacheck
|
||||||
pass_filenames: false
|
pass_filenames: true
|
||||||
args: [-q,.]
|
types: [ file, lua ]
|
||||||
|
args: [ -q ]
|
||||||
|
- id: stylua
|
||||||
|
name: stylua
|
||||||
|
language: system
|
||||||
|
entry: stylua
|
||||||
|
pass_filenames: true
|
||||||
|
types: [ file, lua ]
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
local S = cottages.S
|
local S = cottages.S
|
||||||
local F = minetest.formspec_escape
|
local F = minetest.formspec_escape
|
||||||
local FS = function(...) return F(S(...)) end
|
local FS = function(...)
|
||||||
|
return F(S(...))
|
||||||
|
end
|
||||||
|
|
||||||
local player_can_use = cottages.util.player_can_use
|
local player_can_use = cottages.util.player_can_use
|
||||||
local toggle_public = cottages.util.toggle_public
|
local toggle_public = cottages.util.toggle_public
|
||||||
|
@ -16,7 +18,10 @@ function api.update(pos, node)
|
||||||
local node_name = (node or minetest.get_node(pos)).name
|
local node_name = (node or minetest.get_node(pos)).name
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
if meta:get_string("public") == "public" then
|
if meta:get_int("shared") == 1 then
|
||||||
|
meta:set_int("public", 2)
|
||||||
|
meta:set_int("shared", 0)
|
||||||
|
elseif meta:get_string("public") == "public" then
|
||||||
meta:set_int("public", 2)
|
meta:set_int("public", 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -32,16 +37,13 @@ function api.update(pos, node)
|
||||||
if public == 0 then
|
if public == 0 then
|
||||||
local owner = meta:get_string("owner")
|
local owner = meta:get_string("owner")
|
||||||
table.insert(fs_parts, ("label[6.1,2.1;%s]"):format(FS("owner: @1", owner)))
|
table.insert(fs_parts, ("label[6.1,2.1;%s]"):format(FS("owner: @1", owner)))
|
||||||
|
|
||||||
elseif public == 1 then
|
elseif public == 1 then
|
||||||
table.insert(fs_parts, ("label[6.1,2.1;%s]"):format(FS("(protected)")))
|
table.insert(fs_parts, ("label[6.1,2.1;%s]"):format(FS("(protected)")))
|
||||||
|
|
||||||
elseif public == 2 then
|
elseif public == 2 then
|
||||||
table.insert(fs_parts, ("label[6.1,2.1;%s]"):format(FS("(public)")))
|
table.insert(fs_parts, ("label[6.1,2.1;%s]"):format(FS("(public)")))
|
||||||
end
|
end
|
||||||
|
|
||||||
meta:set_string("formspec", table.concat(fs_parts, ""))
|
meta:set_string("formspec", table.concat(fs_parts, ""))
|
||||||
|
|
||||||
else
|
else
|
||||||
meta:set_string("formspec", "")
|
meta:set_string("formspec", "")
|
||||||
end
|
end
|
||||||
|
@ -52,14 +54,11 @@ function api.update(pos, node)
|
||||||
if public == 0 then
|
if public == 0 then
|
||||||
local owner = meta:get("owner") or "???"
|
local owner = meta:get("owner") or "???"
|
||||||
meta:set_string("infotext", S("@1's private @2", owner, info))
|
meta:set_string("infotext", S("@1's private @2", owner, info))
|
||||||
|
|
||||||
elseif public == 1 then
|
elseif public == 1 then
|
||||||
meta:set_string("infotext", S("protected @1", info))
|
meta:set_string("infotext", S("protected @1", info))
|
||||||
|
|
||||||
elseif public == 2 then
|
elseif public == 2 then
|
||||||
meta:set_string("infotext", S("public @1", info))
|
meta:set_string("infotext", S("public @1", info))
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
meta:set_string("infotext", "")
|
meta:set_string("infotext", "")
|
||||||
end
|
end
|
||||||
|
@ -84,7 +83,7 @@ function api.register_machine(name, def)
|
||||||
groups = def.groups,
|
groups = def.groups,
|
||||||
sounds = def.sounds,
|
sounds = def.sounds,
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer, itemstack)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
if def.inv_info then
|
if def.inv_info then
|
||||||
|
@ -96,6 +95,12 @@ function api.register_machine(name, def)
|
||||||
|
|
||||||
local owner = placer:get_player_name()
|
local owner = placer:get_player_name()
|
||||||
meta:set_string("owner", owner or "")
|
meta:set_string("owner", owner or "")
|
||||||
|
|
||||||
|
local stackmeta = itemstack:get_meta()
|
||||||
|
if stackmeta:get_int("shared") == 1 then
|
||||||
|
meta:set_int("public", 2)
|
||||||
|
end
|
||||||
|
|
||||||
api.update(pos)
|
api.update(pos)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
@ -119,6 +124,12 @@ function api.register_machine(name, def)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
preserve_metadata = function(pos, oldnode, oldmeta, drops)
|
||||||
|
if def.preserve_metadata then
|
||||||
|
def.preserve_metadata(pos, oldnode, oldmeta, drops)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
if fields.public and toggle_public(pos, sender) then
|
if fields.public and toggle_public(pos, sender) then
|
||||||
api.update(pos)
|
api.update(pos)
|
||||||
|
@ -149,9 +160,8 @@ function api.register_machine(name, def)
|
||||||
local owner = meta:get("owner")
|
local owner = meta:get("owner")
|
||||||
local public = meta:get_int("public")
|
local public = meta:get_int("public")
|
||||||
|
|
||||||
return owner == player_name or (
|
return owner == player_name
|
||||||
(public > 0 or owner == "" or owner == " ") and not minetest.is_protected(pos, player_name)
|
or ((public > 0 or owner == "" or owner == " ") and not minetest.is_protected(pos, player_name))
|
||||||
)
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
|
@ -258,7 +268,7 @@ function api.register_machine(name, def)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local drops = {name}
|
local drops = { name }
|
||||||
|
|
||||||
if def.inv_info then
|
if def.inv_info then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
@ -283,7 +293,7 @@ function api.register_machine(name, def)
|
||||||
minetest.register_lbm({
|
minetest.register_lbm({
|
||||||
name = ("cottages:update_formspec_%s"):format(name:gsub(":", "_")),
|
name = ("cottages:update_formspec_%s"):format(name:gsub(":", "_")),
|
||||||
label = ("update %s formspec & infotext"):format(name),
|
label = ("update %s formspec & infotext"):format(name),
|
||||||
nodenames = {name},
|
nodenames = { name },
|
||||||
run_at_every_load = true,
|
run_at_every_load = true,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
api.update(pos, node)
|
api.update(pos, node)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
local S = cottages.S
|
local S = cottages.S
|
||||||
local F = minetest.formspec_escape
|
local F = minetest.formspec_escape
|
||||||
local FS = function(...) return F(S(...)) end
|
local FS = function(...)
|
||||||
|
return F(S(...))
|
||||||
|
end
|
||||||
local anvil = cottages.anvil
|
local anvil = cottages.anvil
|
||||||
|
|
||||||
local add_entity = minetest.add_entity
|
local add_entity = minetest.add_entity
|
||||||
|
@ -44,10 +46,8 @@ function anvil.get_anvil_info(pos)
|
||||||
|
|
||||||
if input:is_empty() then
|
if input:is_empty() then
|
||||||
return S("anvil")
|
return S("anvil")
|
||||||
|
|
||||||
elseif input:get_wear() > 0 then
|
elseif input:get_wear() > 0 then
|
||||||
return S("anvil; repairing @1 (@2%)", get_safe_short_description(input), wear)
|
return S("anvil; repairing @1 (@2%)", get_safe_short_description(input), wear)
|
||||||
|
|
||||||
else
|
else
|
||||||
return S("anvil; @1 is repaired", get_safe_short_description(input))
|
return S("anvil; @1 is repaired", get_safe_short_description(input))
|
||||||
end
|
end
|
||||||
|
@ -55,8 +55,8 @@ end
|
||||||
|
|
||||||
function anvil.get_anvil_fs_parts()
|
function anvil.get_anvil_fs_parts()
|
||||||
return {
|
return {
|
||||||
("size[8,8]"),
|
"size[8,8]",
|
||||||
("image[4,3;1,1;cottages_tool_steelhammer.png]"),
|
"image[4,3;1,1;cottages_tool_steelhammer.png]",
|
||||||
("label[2.5,1.0;%s]"):format(FS("Workpiece:")),
|
("label[2.5,1.0;%s]"):format(FS("Workpiece:")),
|
||||||
("label[6.0,2.7;%s]"):format(FS("Optional")),
|
("label[6.0,2.7;%s]"):format(FS("Optional")),
|
||||||
("label[6.0,3.0;%s]"):format(FS("storage for")),
|
("label[6.0,3.0;%s]"):format(FS("storage for")),
|
||||||
|
@ -64,13 +64,13 @@ function anvil.get_anvil_fs_parts()
|
||||||
("label[0,0.0;%s]"):format(FS("Anvil")),
|
("label[0,0.0;%s]"):format(FS("Anvil")),
|
||||||
("label[0,3.0;%s]"):format(FS("Punch anvil with hammer to")),
|
("label[0,3.0;%s]"):format(FS("Punch anvil with hammer to")),
|
||||||
("label[0,3.3;%s]"):format(FS("repair tool in workpiece-slot.")),
|
("label[0,3.3;%s]"):format(FS("repair tool in workpiece-slot.")),
|
||||||
("list[context;input;2.5,1.5;1,1;]"),
|
"list[context;input;2.5,1.5;1,1;]",
|
||||||
("list[context;hammer;5,3;1,1;]"),
|
"list[context;hammer;5,3;1,1;]",
|
||||||
("list[current_player;main;0,4;8,4;]"),
|
"list[current_player;main;0,4;8,4;]",
|
||||||
("listring[context;hammer]"),
|
"listring[context;hammer]",
|
||||||
("listring[current_player;main]"),
|
"listring[current_player;main]",
|
||||||
("listring[context;input]"),
|
"listring[context;input]",
|
||||||
("listring[current_player;main]"),
|
"listring[current_player;main]",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -81,10 +81,10 @@ local function sparks(pos)
|
||||||
time = 0.1,
|
time = 0.1,
|
||||||
minpos = pos,
|
minpos = pos,
|
||||||
maxpos = pos,
|
maxpos = pos,
|
||||||
minvel = {x = 2, y = 3, z = 2},
|
minvel = { x = 2, y = 3, z = 2 },
|
||||||
maxvel = {x = -2, y = 1, z = -2},
|
maxvel = { x = -2, y = 1, z = -2 },
|
||||||
minacc = {x = 0, y = -10, z = 0},
|
minacc = { x = 0, y = -10, z = 0 },
|
||||||
maxacc = {x = 0, y = -10, z = 0},
|
maxacc = { x = 0, y = -10, z = 0 },
|
||||||
minexptime = 0.5,
|
minexptime = 0.5,
|
||||||
maxexptime = 1,
|
maxexptime = 1,
|
||||||
minsize = 1,
|
minsize = 1,
|
||||||
|
@ -106,7 +106,6 @@ local function update_hud(puncher, tool)
|
||||||
if tool_hud_enabled then
|
if tool_hud_enabled then
|
||||||
hud1, hud2, hud3 = unpack(hud_info_by_puncher_name[puncher_name])
|
hud1, hud2, hud3 = unpack(hud_info_by_puncher_name[puncher_name])
|
||||||
hud1_def = puncher:hud_get(hud1)
|
hud1_def = puncher:hud_get(hud1)
|
||||||
|
|
||||||
else
|
else
|
||||||
hud2, hud3 = unpack(hud_info_by_puncher_name[puncher_name])
|
hud2, hud3 = unpack(hud_info_by_puncher_name[puncher_name])
|
||||||
end
|
end
|
||||||
|
@ -118,16 +117,15 @@ local function update_hud(puncher, tool)
|
||||||
puncher:hud_change(hud1, "text", hud_image)
|
puncher:hud_change(hud1, "text", hud_image)
|
||||||
end
|
end
|
||||||
puncher:hud_change(hud3, "number", damage_state)
|
puncher:hud_change(hud3, "number", damage_state)
|
||||||
|
|
||||||
else
|
else
|
||||||
if tool_hud_enabled and hud_image then
|
if tool_hud_enabled and hud_image then
|
||||||
hud1 = puncher:hud_add({
|
hud1 = puncher:hud_add({
|
||||||
hud_elem_type = "image",
|
hud_elem_type = "image",
|
||||||
name = "anvil_image",
|
name = "anvil_image",
|
||||||
text = hud_image,
|
text = hud_image,
|
||||||
scale = {x = 15, y = 15},
|
scale = { x = 15, y = 15 },
|
||||||
position = {x = 0.5, y = 0.5},
|
position = { x = 0.5, y = 0.5 },
|
||||||
alignment = {x = 0, y = 0}
|
alignment = { x = 0, y = 0 },
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
hud2 = puncher:hud_add({
|
hud2 = puncher:hud_add({
|
||||||
|
@ -136,10 +134,10 @@ local function update_hud(puncher, tool)
|
||||||
text = "default_cloud.png^[colorize:#ff0000:256",
|
text = "default_cloud.png^[colorize:#ff0000:256",
|
||||||
number = 40,
|
number = 40,
|
||||||
direction = 0, -- left to right
|
direction = 0, -- left to right
|
||||||
position = {x = 0.5, y = 0.65},
|
position = { x = 0.5, y = 0.65 },
|
||||||
alignment = {x = 0, y = 0},
|
alignment = { x = 0, y = 0 },
|
||||||
offset = {x = -320, y = 0},
|
offset = { x = -320, y = 0 },
|
||||||
size = {x = 32, y = 32},
|
size = { x = 32, y = 32 },
|
||||||
})
|
})
|
||||||
hud3 = puncher:hud_add({
|
hud3 = puncher:hud_add({
|
||||||
hud_elem_type = "statbar",
|
hud_elem_type = "statbar",
|
||||||
|
@ -147,18 +145,17 @@ local function update_hud(puncher, tool)
|
||||||
text = "default_cloud.png^[colorize:#00ff00:256",
|
text = "default_cloud.png^[colorize:#00ff00:256",
|
||||||
number = damage_state,
|
number = damage_state,
|
||||||
direction = 0, -- left to right
|
direction = 0, -- left to right
|
||||||
position = {x = 0.5, y = 0.65},
|
position = { x = 0.5, y = 0.65 },
|
||||||
alignment = {x = 0, y = 0},
|
alignment = { x = 0, y = 0 },
|
||||||
offset = {x = -320, y = 0},
|
offset = { x = -320, y = 0 },
|
||||||
size = {x = 32, y = 32},
|
size = { x = 32, y = 32 },
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if tool_hud_enabled then
|
if tool_hud_enabled then
|
||||||
hud_info_by_puncher_name[puncher_name] = {hud1, hud2, hud3, os.time() + hud_timeout}
|
hud_info_by_puncher_name[puncher_name] = { hud1, hud2, hud3, os.time() + hud_timeout }
|
||||||
|
|
||||||
else
|
else
|
||||||
hud_info_by_puncher_name[puncher_name] = {hud2, hud3, os.time() + hud_timeout}
|
hud_info_by_puncher_name[puncher_name] = { hud2, hud3, os.time() + hud_timeout }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -178,14 +175,12 @@ function anvil.use_anvil(pos, puncher)
|
||||||
|
|
||||||
if tool:is_empty() then
|
if tool:is_empty() then
|
||||||
return
|
return
|
||||||
|
|
||||||
elseif not anvil.can_repair(tool) then
|
elseif not anvil.can_repair(tool) then
|
||||||
-- just to make sure that tool really can't be repaired if it should not
|
-- just to make sure that tool really can't be repaired if it should not
|
||||||
-- (if the check of placing the item in the input slot failed somehow)
|
-- (if the check of placing the item in the input slot failed somehow)
|
||||||
minetest.chat_send_player(puncher_name, S("@1 is not repairable by the anvil", tool_name))
|
minetest.chat_send_player(puncher_name, S("@1 is not repairable by the anvil", tool_name))
|
||||||
|
|
||||||
elseif tool:get_wear() > 0 then
|
elseif tool:get_wear() > 0 then
|
||||||
minetest.sound_play({name = "anvil_clang"}, {pos = pos})
|
minetest.sound_play({ name = "anvil_clang" }, { pos = pos })
|
||||||
sparks(pos)
|
sparks(pos)
|
||||||
|
|
||||||
-- do the actual repair
|
-- do the actual repair
|
||||||
|
@ -201,7 +196,6 @@ function anvil.use_anvil(pos, puncher)
|
||||||
if has_stamina then
|
if has_stamina then
|
||||||
stamina.exhaust_player(puncher, stamina_use, "cottages:anvil")
|
stamina.exhaust_player(puncher, stamina_use, "cottages:anvil")
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
-- tell the player when the job is done, but only once
|
-- tell the player when the job is done, but only once
|
||||||
if meta:get_int("informed") > 0 then
|
if meta:get_int("informed") > 0 then
|
||||||
|
@ -229,7 +223,6 @@ function anvil.rightclick_anvil(pos, clicker, itemstack)
|
||||||
local taken
|
local taken
|
||||||
if anvil.allow_metadata_inventory_take(pos, "input", 1, input_stack, clicker) > 0 then
|
if anvil.allow_metadata_inventory_take(pos, "input", 1, input_stack, clicker) > 0 then
|
||||||
taken = inv:remove_item("input", input_stack)
|
taken = inv:remove_item("input", input_stack)
|
||||||
|
|
||||||
elseif anvil.allow_metadata_inventory_take(pos, "hammer", 1, hammer_stack, clicker) > 0 then
|
elseif anvil.allow_metadata_inventory_take(pos, "hammer", 1, hammer_stack, clicker) > 0 then
|
||||||
taken = inv:remove_item("hammer", hammer_stack)
|
taken = inv:remove_item("hammer", hammer_stack)
|
||||||
end
|
end
|
||||||
|
@ -240,7 +233,6 @@ function anvil.rightclick_anvil(pos, clicker, itemstack)
|
||||||
inv:add_item("input", itemstack)
|
inv:add_item("input", itemstack)
|
||||||
itemstack:clear()
|
itemstack:clear()
|
||||||
meta:set_int("informed", 0)
|
meta:set_int("informed", 0)
|
||||||
|
|
||||||
elseif taken and not itemstack:is_empty() then
|
elseif taken and not itemstack:is_empty() then
|
||||||
-- put it back
|
-- put it back
|
||||||
inv:add_item("input", input_stack)
|
inv:add_item("input", input_stack)
|
||||||
|
@ -261,11 +253,9 @@ function anvil.get_entity(pos)
|
||||||
local ent_pos = ent.pos
|
local ent_pos = ent.pos
|
||||||
if not ent_pos then
|
if not ent_pos then
|
||||||
obj:remove()
|
obj:remove()
|
||||||
|
|
||||||
elseif v_eq(ent_pos, pos) then
|
elseif v_eq(ent_pos, pos) then
|
||||||
if to_return then
|
if to_return then
|
||||||
obj:remove()
|
obj:remove()
|
||||||
|
|
||||||
else
|
else
|
||||||
to_return = obj
|
to_return = obj
|
||||||
end
|
end
|
||||||
|
@ -297,11 +287,11 @@ function anvil.add_entity(pos)
|
||||||
|
|
||||||
local entity_pos = v_add(pos, v_new(0, tool_entity_displacement, 0))
|
local entity_pos = v_add(pos, v_new(0, tool_entity_displacement, 0))
|
||||||
|
|
||||||
local obj = add_entity(entity_pos, "cottages:anvil_item", serialize({pos, tool_name}))
|
local obj = add_entity(entity_pos, "cottages:anvil_item", serialize({ pos, tool_name }))
|
||||||
|
|
||||||
if obj then
|
if obj then
|
||||||
local yaw = math.pi * 2 - node.param2 * math.pi / 2
|
local yaw = math.pi * 2 - node.param2 * math.pi / 2
|
||||||
obj:set_rotation({ x = -math.pi / 2, y = yaw, z = 0}) -- x is pitch
|
obj:set_rotation({ x = -math.pi / 2, y = yaw, z = 0 }) -- x is pitch
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -314,14 +304,12 @@ function anvil.update_entity(pos)
|
||||||
|
|
||||||
if tool:is_empty() and obj then
|
if tool:is_empty() and obj then
|
||||||
anvil.clear_entity(pos)
|
anvil.clear_entity(pos)
|
||||||
|
|
||||||
elseif obj then
|
elseif obj then
|
||||||
local e = obj:get_luaentity()
|
local e = obj:get_luaentity()
|
||||||
if e.item ~= tool_name then
|
if e.item ~= tool_name then
|
||||||
e.item = tool_name
|
e.item = tool_name
|
||||||
obj:set_properties({wield_item = tool_name})
|
obj:set_properties({ wield_item = tool_name })
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif tool_entity_enabled and not tool:is_empty() then
|
elseif tool_entity_enabled and not tool:is_empty() then
|
||||||
anvil.add_entity(pos)
|
anvil.add_entity(pos)
|
||||||
end
|
end
|
||||||
|
@ -375,8 +363,10 @@ function anvil.allow_metadata_inventory_move(pos, from_list, from_index, to_list
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local from_stack = inv:get_stack(from_list, from_index)
|
local from_stack = inv:get_stack(from_list, from_index)
|
||||||
|
|
||||||
if anvil.allow_metadata_inventory_take(pos, from_list, from_index, from_stack, player) > 0
|
if
|
||||||
and anvil.allow_metadata_inventory_put(pos, to_list, to_index, from_stack, player) > 0 then
|
anvil.allow_metadata_inventory_take(pos, from_list, from_index, from_stack, player) > 0
|
||||||
|
and anvil.allow_metadata_inventory_put(pos, to_list, to_index, from_stack, player) > 0
|
||||||
|
then
|
||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -424,7 +414,6 @@ function anvil.preserve_metadata(pos, oldnode, oldmeta, drops)
|
||||||
if owner == "" then
|
if owner == "" then
|
||||||
drop_meta:set_int("shared", 1)
|
drop_meta:set_int("shared", 1)
|
||||||
drop_meta:set_string("description", S("Anvil (public)"))
|
drop_meta:set_string("description", S("Anvil (public)"))
|
||||||
|
|
||||||
elseif owner == " " then
|
elseif owner == " " then
|
||||||
drop_meta:set_int("shared", 2)
|
drop_meta:set_int("shared", 2)
|
||||||
drop_meta:set_string("description", S("Anvil (protected)"))
|
drop_meta:set_string("description", S("Anvil (protected)"))
|
||||||
|
@ -438,6 +427,19 @@ function anvil.on_destruct(pos)
|
||||||
anvil.clear_entity(pos)
|
anvil.clear_entity(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function anvil.preserve_metadata(pos, oldnode, oldmeta, drops)
|
||||||
|
if tonumber(oldmeta.public) == 2 then
|
||||||
|
for _, drop in ipairs(drops) do
|
||||||
|
if drop:get_name() == "cottages:anvil" then
|
||||||
|
local dropmeta = drop:get_meta()
|
||||||
|
dropmeta:set_int("shared", 1)
|
||||||
|
dropmeta:set_string("description", S("Anvil (public)"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return drops
|
||||||
|
end
|
||||||
|
|
||||||
cottages.api.register_machine("cottages:anvil", {
|
cottages.api.register_machine("cottages:anvil", {
|
||||||
description = S("anvil"),
|
description = S("anvil"),
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
|
@ -445,14 +447,14 @@ cottages.api.register_machine("cottages:anvil", {
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
{-0.5, -0.5, -0.3, 0.5, -0.4, 0.3},
|
{ -0.5, -0.5, -0.3, 0.5, -0.4, 0.3 },
|
||||||
{-0.35, -0.4, -0.25, 0.35, -0.3, 0.25},
|
{ -0.35, -0.4, -0.25, 0.35, -0.3, 0.25 },
|
||||||
{-0.3, -0.3, -0.15, 0.3, -0.1, 0.15},
|
{ -0.3, -0.3, -0.15, 0.3, -0.1, 0.15 },
|
||||||
{-0.35, -0.1, -0.2, 0.35, 0.1, 0.2},
|
{ -0.35, -0.1, -0.2, 0.35, 0.1, 0.2 },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
tiles = {"cottages_stone.png^[colorize:#000:192"},
|
tiles = { "cottages_stone.png^[colorize:#000:192" },
|
||||||
groups = {cracky = 2},
|
groups = { cracky = 2 },
|
||||||
sounds = cottages.sounds.metal,
|
sounds = cottages.sounds.metal,
|
||||||
|
|
||||||
inv_info = {
|
inv_info = {
|
||||||
|
@ -474,6 +476,7 @@ cottages.api.register_machine("cottages:anvil", {
|
||||||
allow_metadata_inventory_take = anvil.allow_metadata_inventory_take,
|
allow_metadata_inventory_take = anvil.allow_metadata_inventory_take,
|
||||||
|
|
||||||
on_destruct = anvil.on_destruct,
|
on_destruct = anvil.on_destruct,
|
||||||
|
preserve_metadata = anvil.preserve_metadata,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- clear hud info
|
-- clear hud info
|
||||||
|
@ -485,7 +488,6 @@ minetest.register_globalstep(function()
|
||||||
local hud1, hud2, hud3, hud_expire_time
|
local hud1, hud2, hud3, hud_expire_time
|
||||||
if tool_hud_enabled then
|
if tool_hud_enabled then
|
||||||
hud1, hud2, hud3, hud_expire_time = unpack(hud_info)
|
hud1, hud2, hud3, hud_expire_time = unpack(hud_info)
|
||||||
|
|
||||||
else
|
else
|
||||||
hud2, hud3, hud_expire_time = unpack(hud_info)
|
hud2, hud3, hud_expire_time = unpack(hud_info)
|
||||||
end
|
end
|
||||||
|
@ -511,7 +513,6 @@ minetest.register_globalstep(function()
|
||||||
|
|
||||||
hud_info_by_puncher_name[puncher_name] = nil
|
hud_info_by_puncher_name[puncher_name] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
hud_info_by_puncher_name[puncher_name] = nil
|
hud_info_by_puncher_name[puncher_name] = nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
if cottages.has.technic then
|
if cottages.has.technic then
|
||||||
-- make rechargeable technic tools unrepairable`
|
-- make rechargeable technic tools unrepairable`
|
||||||
cottages.anvil.make_unrepairable("technic:water_can")
|
cottages.anvil.make_unrepairable("technic:water_can")
|
||||||
|
@ -27,12 +26,10 @@ if cottages.has.technic then
|
||||||
end
|
end
|
||||||
|
|
||||||
if cottages.has.anvil then
|
if cottages.has.anvil then
|
||||||
minetest.clear_craft({output = "anvil:anvil"})
|
minetest.clear_craft({ output = "anvil:anvil" })
|
||||||
minetest.register_alias_force("anvil:anvil", "cottages:anvil")
|
minetest.register_alias_force("anvil:anvil", "cottages:anvil")
|
||||||
|
minetest.clear_craft({ output = "anvil:hammer" })
|
||||||
minetest.clear_craft({output = "anvil:hammer"})
|
|
||||||
minetest.register_alias_force("anvil:hammer", "cottages:hammer")
|
minetest.register_alias_force("anvil:hammer", "cottages:hammer")
|
||||||
|
|
||||||
else
|
else
|
||||||
minetest.register_alias("anvil:anvil", "cottages:anvil")
|
minetest.register_alias("anvil:anvil", "cottages:anvil")
|
||||||
minetest.register_alias("anvil:hammer", "cottages:hammer")
|
minetest.register_alias("anvil:hammer", "cottages:hammer")
|
||||||
|
|
|
@ -5,17 +5,19 @@ if ci.steel then
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "cottages:anvil",
|
output = "cottages:anvil",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ci.steel, ci.steel, ci.steel},
|
{ ci.steel, ci.steel, ci.steel },
|
||||||
{"", ci.steel, ""},
|
{ "", ci.steel, "" },
|
||||||
{ci.steel, ci.steel, ci.steel}},
|
{ ci.steel, ci.steel, ci.steel },
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "cottages:hammer",
|
output = "cottages:hammer",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ci.steel},
|
{ ci.steel },
|
||||||
{"cottages:anvil"},
|
{ "cottages:anvil" },
|
||||||
{ci.stick}}
|
{ ci.stick },
|
||||||
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -28,29 +30,16 @@ if ci.paper then
|
||||||
return stack:to_string()
|
return stack:to_string()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function build_protected_string()
|
|
||||||
local stack = ItemStack("cottages:anvil")
|
|
||||||
local meta = stack:get_meta()
|
|
||||||
meta:set_int("shared", 2)
|
|
||||||
meta:set_string("description", S("Anvil (protected)"))
|
|
||||||
return stack:to_string()
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = build_protected_string(),
|
|
||||||
type = "shapeless",
|
|
||||||
recipe = {"cottages:anvil", ci.paper}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = build_public_string(),
|
output = build_public_string(),
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
recipe = {build_protected_string(), ci.paper}
|
recipe = { "cottages:anvil", ci.paper },
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "cottages:anvil",
|
|
||||||
type = "shapeless",
|
|
||||||
recipe = {build_public_string(), ci.paper}
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- allows reverting public anvil
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "cottages:anvil",
|
||||||
|
type = "shapeless",
|
||||||
|
recipe = { "cottages:anvil" },
|
||||||
|
})
|
||||||
|
|
|
@ -2,9 +2,11 @@ local S = cottages.S
|
||||||
|
|
||||||
minetest.register_node("cottages:rope", {
|
minetest.register_node("cottages:rope", {
|
||||||
description = S("Rope"),
|
description = S("Rope"),
|
||||||
tiles = {"cottages_rope.png"},
|
tiles = { "cottages_rope.png" },
|
||||||
groups = {
|
groups = {
|
||||||
snappy = 3, choppy = 3, oddly_breakable_by_hand = 3,
|
snappy = 3,
|
||||||
|
choppy = 3,
|
||||||
|
oddly_breakable_by_hand = 3,
|
||||||
},
|
},
|
||||||
walkable = false,
|
walkable = false,
|
||||||
climbable = true,
|
climbable = true,
|
||||||
|
@ -13,7 +15,7 @@ minetest.register_node("cottages:rope", {
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
can_dig = function(pos, player)
|
can_dig = function(pos, player)
|
||||||
local below = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
|
local below = minetest.get_node({ x = pos.x, y = pos.y - 1, z = pos.z })
|
||||||
|
|
||||||
if below.name == "cottages:rope" then
|
if below.name == "cottages:rope" then
|
||||||
if minetest.is_player(player) then
|
if minetest.is_player(player) then
|
||||||
|
@ -25,16 +27,16 @@ minetest.register_node("cottages:rope", {
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
if cottages.has.carts then
|
if cottages.has.carts then
|
||||||
local groups = table.copy(carts:get_rail_groups())
|
local groups = table.copy(carts:get_rail_groups())
|
||||||
groups.attached_node = 1
|
groups.attached_node = 0
|
||||||
carts:register_rail("cottages:ladder_with_rope_and_rail", {
|
carts:register_rail("cottages:ladder_with_rope_and_rail", {
|
||||||
description = S("Ladder with \"rail support\""),
|
description = S('Ladder with "rail support"'),
|
||||||
tiles = {
|
tiles = {
|
||||||
"default_ladder_wood.png^carts_rail_straight.png^cottages_rope.png"
|
"default_ladder_wood.png^carts_rail_straight.png^cottages_rope.png",
|
||||||
},
|
},
|
||||||
inventory_image = "default_ladder_wood.png",
|
inventory_image = "default_ladder_wood.png",
|
||||||
wield_image = "default_ladder_wood.png",
|
wield_image = "default_ladder_wood.png",
|
||||||
|
@ -43,15 +45,14 @@ if cottages.has.carts then
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
legacy_wallmounted = true,
|
legacy_wallmounted = true,
|
||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
else
|
else
|
||||||
minetest.register_node("cottages:ladder_with_rope_and_rail", {
|
minetest.register_node("cottages:ladder_with_rope_and_rail", {
|
||||||
description = S("Ladder with \"rail support\""),
|
description = S('Ladder with "rail support"'),
|
||||||
inventory_image = "default_ladder_wood.png",
|
inventory_image = "default_ladder_wood.png",
|
||||||
wield_image = "default_ladder_wood.png",
|
wield_image = "default_ladder_wood.png",
|
||||||
drawtype = "raillike",
|
drawtype = "raillike",
|
||||||
tiles = {
|
tiles = {
|
||||||
"default_ladder_wood.png^carts_rail_straight.png^cottages_rope.png"
|
"default_ladder_wood.png^carts_rail_straight.png^cottages_rope.png",
|
||||||
},
|
},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
|
@ -63,9 +64,10 @@ else
|
||||||
type = "wallmounted",
|
type = "wallmounted",
|
||||||
},
|
},
|
||||||
groups = {
|
groups = {
|
||||||
choppy = 2, oddly_breakable_by_hand = 3, rail = 1,
|
choppy = 2,
|
||||||
|
oddly_breakable_by_hand = 3,
|
||||||
|
rail = 1,
|
||||||
connect_to_raillike = minetest.raillike_group("rail"),
|
connect_to_raillike = minetest.raillike_group("rail"),
|
||||||
attached_node = 1,
|
|
||||||
},
|
},
|
||||||
legacy_wallmounted = true,
|
legacy_wallmounted = true,
|
||||||
sounds = cottages.sounds.wood,
|
sounds = cottages.sounds.wood,
|
||||||
|
|
Loading…
Reference in New Issue