code cleanup and updates for recents changes in mobs_redo api and minetest (translation)

master
xisd 2020-01-13 16:53:32 +01:00
parent e809a938a3
commit b58cd80e8d
9 changed files with 97 additions and 81 deletions

View File

@ -1,4 +1,3 @@
default
mobs
mobs_creatures?
treasurer?

2
dialogs/default.fr.txt Executable file
View File

@ -0,0 +1,2 @@
Bonjour.
Etc.

View File

@ -1,13 +1,14 @@
--
-- This mod provides NPCs using the mobs_redo api
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
-- Load support for intllib.
local S, NS = dofile(modpath.."/intllib.lua")
mobs.intllib = S
-- Load support for translations.
local S = minetest.get_translator('mobs')
mobs.translator = S
-- Load support for documentation
mobs.textstrings = {}
mobs.textstrings.longdesc = {}
mobs.textstrings.usagehelp = {}
@ -24,24 +25,12 @@ dofile(modpath .. "/mobs_definitions.lua")
dofile(modpath .. "/npc_lambda.lua")
dofile(modpath .. "/npc_custom.lua")
--dofile(modpath .. "/npc_trader.lua")
--dofile(modpath .. "/npc_soldier.lua")
--dofile(modpath .. "/npc_monk.lua")
--
-- Map generation
--
--dofile(modpath .. "/mobs_mapgen.lua")
--
-- Compatibility
-- Mods Compatibility
--
--dofile(modpath .. "/lucky_block.lua")
--
@ -49,24 +38,37 @@ dofile(modpath .. "/npc_custom.lua")
--
minetest.register_abm({
label = "Bed npc spawning",
nodenames = {"default:bed"},
-- neighbors = {"default:water_source", "default:water_flowing"},
interval = 150, -- Operation interval in seconds
chance = 1, -- Chance of trigger per-node per-interval is 1.0 / this
-- catch_up = true, -- If true, catch-up behaviour is enabled --[[
--~ ^ The chance value is temporarily reduced when returning to
--~ an area to simulate time lost by the area being unattended.
--~ ^ Note chance value can often be reduced to 1 ]]
action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.get_meta(pos)
local spawn = meta:get_string("spawn")
if not spawn then return end
spawn_pos = math.random()
end,
})
--
-- Map generation (for spawner)
--
--dofile(modpath .. "/mobs_mapgen.lua")
--
-- WIP: Make Ncps spawn around beds, or not-owned beds, or maybe use a mod register a mobs_bed instead of using the default...
-- -- The point is that if you build a village with beds in houses, there will be some npcs there.
--minetest.register_abm({
-- label = "Bed npc spawning",
-- nodenames = {"default:bed"},
-- -- neighbors = {"default:water_source", "default:water_flowing"},
-- interval = 150, -- Operation interval in seconds
-- chance = 1, -- Chance of trigger per-node per-interval is 1.0 / this
-- -- catch_up = true, -- If true, catch-up behaviour is enabled --[[
-- --~ ^ The chance value is temporarily reduced when returning to
-- --~ an area to simulate time lost by the area being unattended.
-- --~ ^ Note chance value can often be reduced to 1 ]]
-- action = function(pos, node, active_object_count, active_object_count_wider)
-- local meta = minetest.get_meta(pos)
-- local spawn = meta:get_string("spawn")
-- --if not spawn then return end
-- --spawn_pos = math.random()
-- end,
--})
--
-- Notification
--
print ("[MOD] Mobs Redo 'mobs_bundle_npc' loaded")
print ("[MOD] Mobs Redo 'mobs_npc' loaded")

View File

@ -2,7 +2,9 @@
-- This file adds function to complete the mobs_redo api
--
local S = mobs.intllib
-- Translator
local S = mobs.translator
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)

View File

@ -2,7 +2,8 @@
-- This file register nodes and items needed by this mod
--
local S = mobs.intllib
-- Translator
local S = mobs.translator
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)

View File

@ -2,7 +2,9 @@
-- This file contains base définition used to most npcs
--
local S = mobs.intllib
-- Translator
local S = mobs.translator
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
@ -10,24 +12,31 @@ if not mobs.npcs then mobs.npcs = {} end
mobs.npcs.base_def = {
-- Base NPC looks like players
-- -- Most values are from player api
type = "npc",
visual = "mesh",
mesh = "character-old.b3d",
textures = {
{"character.png"},
},
collisionbox = {-0.25, -1, -0.3, 0.25, 0.75, 0.3},
mesh = "character.b3d",
textures = {"character.png", },
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
animation = {
speed_normal = 15, speed_run = 25,
speed_normal = 20, speed_run = 32, run_speed = 32,
stand_start = 0, stand_end = 79,
sit_start = 81, sit_end = 160,
-- stand2_start = 81, stand2_end = 160, -- sit
lay_start = 162, lay_end = 166,
-- death = {start = 162, stop = 166, speed = 28, loop = false, duration = 2.12},
-- death_start = 162, death_end = 166,
walk_start = 168, walk_end = 188,
walk_start = 168, walk_end = 187,
mine_start = 189, mine_end = 198,
attack_start = 200, attack_end = 119, -- walk_mine
run_start = 221, run_end = 241
walk_mine_start = 200, walk_mine__end = 119,
punch_start = 200, punch_end = 119, -- walk_mine
-- punch2_start = 200, punch2_end = 119, -- walk_mine
-- shoot_start = 200, shoot_end = 119, -- walk_mine
run_start = 221, run_end = 241, -- ??
die_start = 162, die_end = 166, -- lay
die_loop = true, die_speed = 28,
},
makes_footstep_sound = true,
@ -38,6 +47,9 @@ mobs.npcs.base_def = {
--~ -- damage = "mobs_zombie_hit",
--~ -- death = "mobs_zombie_death",
--~ },
-- NPC aren't made to be fighters
-- killing them should be either very discouraged or very boring
hp_min = 12,
hp_max = 35,
armor = 200,
@ -48,20 +60,23 @@ mobs.npcs.base_def = {
attack_type = "dogfight",
group_attack = true,
view_range = 10,
walk_chance = 75,
-- stand_chance = 14,
walk_chance = 74,
walk_velocity = 1,
run_velocity = 2,
step_height = 0.6,
run_velocity = 2.2,
fear_height = 3,
jump = true,
stepheight = 1.3,
jump_height = 1.1,
-- fly_in = {"default:water_source", "default:water_flowing", "default:river_water_source", "default:river_water_flowing"},
-- floats = 0,
--~ drops = {
--~ {name = "mobs:rotten_flesh", chance = 6, min = 1, max = 3,}
--~ },
lifetimer = 180, -- 3 minutes
shoot_interval = 135, -- (lifetimer - (lifetimer / 4)), borrowed for do_custom time
shoot_interval = 135, -- (lifetimer - (lifetimer / 4)), borrowed from do_custom time
-- Default right click is to look at player and says something
on_rightclick = function(self, clicker)
-- Look at the player
mobs.npcs.turn_to_player( self, clicker )
@ -73,6 +88,10 @@ mobs.npcs.base_def = {
end
}
-- Spawning
-- -- This should be improved
-- -- Poeples are a bit like sheeps, you can find them were there is sun and grass or trees
local spawn_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter",
"default:dirt_with_coniferous_litter", "ethereal:bamboo_dirt"}
-- local spawn_on = {"group:soil"}

View File

@ -1,9 +1,9 @@
-- Configurable NPC
-- This is a configurable NPC
--
--
-- Intllib
local S = mobs.intllib
-- Translator
local S = mobs.translator
local vlog = "action" --"info"
-- Mod related infos
@ -461,7 +461,7 @@ minetest.register_node(spawner_id, {
sounds = default.node_sound_stone_defaults(),
node_box = {
type = "fixed",
fixed = {-0.5, -0.48, -0.5, 0.5, -0.5, 0.5},
fixed = {-0.5, -0.48, -0.5, 0.3, -0.5, 0.3},
},
on_construct = function(pos)
-- minetest.get_node_timer(pos):start(20)

View File

@ -1,8 +1,9 @@
-- Basic NPC
-- Wander around and says things
-- Wander around and says random things
-- Translator
local S = mobs.translator
-- Intllib
local S = mobs.intllib
-- Mod related infos
local modname = minetest.get_current_modname()
@ -23,20 +24,16 @@ local mob_def = mobs.npcs.base_def
local textures = mobs.npcs.get_textures_array("character_lambda_",modname)
if textures then mob_def.textures = textures end
-- Set specific interactions (say something)
-- Basic npc don't not fight
mob_def.runaway = true
--
-- Register Npc
--
mobs:register_mob(mob_id, mob_def)
--
-- Register Spawn condition and egg
--
@ -46,7 +43,6 @@ local mob_spawndef = mobs.npcs.base_spawndef
-- Add specific infos
mob_spawndef.name = mob_id
--~ mob_spawndef.node = {"group:soil"}
-- Regiser spawn
mobs:spawn(mob_spawndef)

View File

@ -1,15 +1,10 @@
# This file contains settings of mobs_bundle that can be changed in
# This file contains settings of mobs_napcs that can be changed in
# minetest.conf
# General
# Birds
mobs.animal_birds.enable_gulls bool true
mobs.animal_birds.enable_large_birds bool false
mobs.animal_birds.enable_large_birds bool true
# Fish
mobs.animal_fish.sprite_version bool false
# Zombies
mobs.monster_zombie.enable_mini_zombies bool false
# Not implemented yet
mobs.npcs.enable_childrens bool true
mobs.npcs.enable_harmful_revenant bool true
mobs.npcs.revenants enum mobs:zombie,mobs:mummy,mobs:ghost
mobs.npcs.enable_harmful_mummie bool true
mobs.npcs.enable_childrens bool true
mobs.npcs.enable_childrens bool true