first commit
21
config.lua
Normal file
@ -0,0 +1,21 @@
|
||||
-- Do the NPCs talk right after they spawned?
|
||||
|
||||
yl_speak_up.talk_after_spawn = true
|
||||
|
||||
-- What shall we call the folder all the dialogs will reside in?
|
||||
|
||||
yl_speak_up.path = "yl_speak_up_dialogs"
|
||||
|
||||
-- Texts
|
||||
|
||||
yl_speak_up.message_button_option_exit = "Farewell!"
|
||||
yl_speak_up.message_button_option_prerequisites_not_met_default = "Locked answer"
|
||||
yl_speak_up.message_tool_taken_because_of_lacking_priv = "We took the tool from you and logged this event. You used an admin item while lacking the neccessary priv npc_master"
|
||||
yl_speak_up.text_new_dialog_id = "New dialog"
|
||||
yl_speak_up.text_new_option_id = "New option"
|
||||
yl_speak_up.text_new_prerequisite_id = "New prerequisite"
|
||||
yl_speak_up.text_new_result_id = "New result"
|
||||
yl_speak_up.text_version_warning = "You are using an outdated Minetest version!\nI will have a hard time talking to you properly, but I will try my best.\nYou can help me by upgrading to at least 5.3.0!\nGet it at https://minetest.net/downloads"
|
||||
yl_speak_up.infotext = "Rightclick to talk"
|
||||
|
||||
yl_speak_up.max_number_of_buttons = 7
|
107
dev/example.json
Normal file
@ -0,0 +1,107 @@
|
||||
{
|
||||
"n_id": "n_1",
|
||||
"n_npc": "Mayor",
|
||||
"n_description": "The Mayor of Haven",
|
||||
"n_dialogs": {
|
||||
"d_1": {
|
||||
"d_id": "d_1",
|
||||
"d_type": "text",
|
||||
"d_text": "Hello Adventurer, I am the Mayor of Haven.",
|
||||
"d_options": {
|
||||
"o_1": {
|
||||
"o_id": "o_1",
|
||||
"o_hide_when_prerequisites_not_met": "false",
|
||||
"o_grey_when_prerequisites_not_met": "true",
|
||||
"o_text_when_prerequisites_not_met": "",
|
||||
"o_text_when_prerequisites_met": "",
|
||||
"o_prerequisites": {
|
||||
"p_1": {
|
||||
"p_id": "p_1",
|
||||
"p_type": "auto",
|
||||
"p_value": "5"
|
||||
}
|
||||
},
|
||||
"o_results": {
|
||||
"r_1": {
|
||||
"r_id": "r_1",
|
||||
"r_type": "dialog",
|
||||
"r_value": "2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"d_2": {
|
||||
"d_id": "d_2",
|
||||
"d_text": "What can I do for you?",
|
||||
"d_options": {
|
||||
"o_1": {
|
||||
"o_id": "o_1",
|
||||
"o_hide_when_prerequisites_not_met": "false",
|
||||
"o_grey_when_prerequisites_not_met": "true",
|
||||
"o_text_when_prerequisites_not_met": "This option is not available.",
|
||||
"o_text_when_prerequisites_met": "Let's talk about the plots in the city!",
|
||||
"o_prerequisites": {},
|
||||
"o_results": {
|
||||
"r_1": {
|
||||
"r_id": "r_1",
|
||||
"r_type": "dialog",
|
||||
"r_value": "3"
|
||||
}
|
||||
}
|
||||
},
|
||||
"o_2": {
|
||||
"o_id": "o_2",
|
||||
"o_hide_when_prerequisites_not_met": "false",
|
||||
"o_grey_when_prerequisites_not_met": "true",
|
||||
"o_text_when_prerequisites_not_met": "This option is not available.",
|
||||
"o_text_when_prerequisites_met": "Let's talk about Airports!",
|
||||
"o_prerequisites": {},
|
||||
"o_results": {
|
||||
"r_1": {
|
||||
"r_id": "r_1",
|
||||
"r_type": "dialog",
|
||||
"r_value": "4"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"d_3": {
|
||||
"d_id": "d_3",
|
||||
"d_text": "Text3",
|
||||
"d_options": {
|
||||
"o_1": {
|
||||
"o_id": "o_1",
|
||||
"o_hide_when_prerequisites_not_met": "false",
|
||||
"o_grey_when_prerequisites_not_met": "true",
|
||||
"o_text_when_prerequisites_not_met": "This option is not available.",
|
||||
"o_text_when_prerequisites_met": "Let's talk about the plots in the city!",
|
||||
"o_prerequisites": {},
|
||||
"o_results": {
|
||||
"r_1": {
|
||||
"r_id": "r_1",
|
||||
"r_type": "dialog",
|
||||
"r_value": "3"
|
||||
}
|
||||
}
|
||||
},
|
||||
"o_2": {
|
||||
"o_id": "o_2",
|
||||
"o_hide_when_prerequisites_not_met": "false",
|
||||
"o_grey_when_prerequisites_not_met": "true",
|
||||
"o_text_when_prerequisites_not_met": "This option is not available.",
|
||||
"o_text_when_prerequisites_met": "Let's talk about Airports!",
|
||||
"o_prerequisites": {},
|
||||
"o_results": {
|
||||
"r_1": {
|
||||
"r_id": "r_1",
|
||||
"r_type": "dialog",
|
||||
"r_value": "4"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
80
dev/example2.json
Normal file
@ -0,0 +1,80 @@
|
||||
{
|
||||
"n_id": "n_12",
|
||||
"n_npc": "Mayor",
|
||||
"n_description": "The Mayor of Haven",
|
||||
"n_dialogs": {
|
||||
"d_1": {
|
||||
"d_id": "d_1",
|
||||
"d_type": "text",
|
||||
"d_text": "Hello Adventurer, I am the Mayor of Haven.",
|
||||
"d_options": {
|
||||
"o_1": {
|
||||
"o_id": "o_1",
|
||||
"o_hide_when_prerequisites_not_met": "false",
|
||||
"o_grey_when_prerequisites_not_met": "true",
|
||||
"o_text_when_prerequisites_not_met": "o_1 notmet",
|
||||
"o_text_when_prerequisites_met": "o_1 met",
|
||||
"o_prerequisites": {
|
||||
"p_1": {
|
||||
"p_id": "p_1",
|
||||
"p_type": "auto",
|
||||
"p_value": "5"
|
||||
}
|
||||
},
|
||||
"o_results": {
|
||||
"r_1": {
|
||||
"r_id": "r_1",
|
||||
"r_type": "dialog",
|
||||
"r_value": "2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"o_2": {
|
||||
"o_id": "o_2",
|
||||
"o_hide_when_prerequisites_not_met": "false",
|
||||
"o_grey_when_prerequisites_not_met": "true",
|
||||
"o_text_when_prerequisites_not_met": "o_2 notmet",
|
||||
"o_text_when_prerequisites_met": "o_2 met",
|
||||
"o_prerequisites": {
|
||||
"p_1": {
|
||||
"p_id": "p_1",
|
||||
"p_type": "auto",
|
||||
"p_value": "5"
|
||||
}
|
||||
},
|
||||
"o_results": {
|
||||
"r_1": {
|
||||
"r_id": "r_1",
|
||||
"r_type": "dialog",
|
||||
"r_value": "2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"o_3": {
|
||||
"o_id": "o_3",
|
||||
"o_hide_when_prerequisites_not_met": "false",
|
||||
"o_grey_when_prerequisites_not_met": "true",
|
||||
"o_text_when_prerequisites_not_met": "o3 notmet",
|
||||
"o_text_when_prerequisites_met": "o3 met",
|
||||
"o_prerequisites": {
|
||||
"p_1": {
|
||||
"p_id": "p_1",
|
||||
"p_type": "auto",
|
||||
"p_value": "5"
|
||||
}
|
||||
},
|
||||
"o_results": {
|
||||
"r_1": {
|
||||
"r_id": "r_1",
|
||||
"r_type": "dialog",
|
||||
"r_value": "2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
1
dev/n_1.json
Normal file
@ -0,0 +1 @@
|
||||
{ "n_id": "n_1", "n_npc": "Mayor", "n_description": "The Mayor of Haven", "n_dialogs": { "d_1": { "d_id": "d_1", "d_type": "text", "d_text": "Hello Adventurer, I am the Mayor of Haven.", "d_options": { "o_1": { "o_id": "o_1", "o_hide_when_prerequisites_not_met": "false", "o_grey_when_prerequisites_not_met": "true", "o_text_when_prerequisites_not_met": "", "o_text_when_prerequisites_met": "", "o_prerequisites": { "p_1": { "p_id": "p_1", "p_type": "auto", "p_value": "5" } }, "o_results": { "r_1": { "r_id": "r_1", "r_type": "dialog", "r_value": "2" } } } } }, "d_2": { "d_id": "d_2", "d_text": "What can I do for you?", "d_options": { "o_1": { "o_id": "o_1", "o_hide_when_prerequisites_not_met": "false", "o_grey_when_prerequisites_not_met": "true", "o_text_when_prerequisites_not_met": "This option is not available.", "o_text_when_prerequisites_met": "Let's talk about the plots in the city!", "o_prerequisites": {}, "o_results": { "r_1": { "r_id": "r_1", "r_type": "dialog", "r_value": "3" } } }, "o_2": { "o_id": "o_2", "o_hide_when_prerequisites_not_met": "false", "o_grey_when_prerequisites_not_met": "true", "o_text_when_prerequisites_not_met": "This option is not available.", "o_text_when_prerequisites_met": "Let's talk about Airports!", "o_prerequisites": {}, "o_results": { "r_1": { "r_id": "r_1", "r_type": "dialog", "r_value": "4" } } } } }, "d_3": { "d_id": "d_3", "d_text": "Text3", "d_options": { "o_1": { "o_id": "o_1", "o_hide_when_prerequisites_not_met": "false", "o_grey_when_prerequisites_not_met": "true", "o_text_when_prerequisites_not_met": "This option is not available.", "o_text_when_prerequisites_met": "Let's talk about the plots in the city!", "o_prerequisites": {}, "o_results": { "r_1": { "r_id": "r_1", "r_type": "dialog", "r_value": "3" } } }, "o_2": { "o_id": "o_2", "o_hide_when_prerequisites_not_met": "false", "o_grey_when_prerequisites_not_met": "true", "o_text_when_prerequisites_not_met": "This option is not available.", "o_text_when_prerequisites_met": "Let's talk about Airports!", "o_prerequisites": {}, "o_results": { "r_1": { "r_id": "r_1", "r_type": "dialog", "r_value": "4" } } } } } } }
|
77
dev/n_12.json
Normal file
@ -0,0 +1,77 @@
|
||||
{
|
||||
"n_id": "n_12",
|
||||
"n_npc": "Mayor",
|
||||
"n_description": "The Mayor of Haven",
|
||||
"n_dialogs": {
|
||||
"d_1": {
|
||||
"d_id": "d_1",
|
||||
"d_type": "text",
|
||||
"d_text": "Hello Adventurer, I am the Mayor of Haven.",
|
||||
"d_options": {
|
||||
"o_1": {
|
||||
"o_id": "o_1",
|
||||
"o_hide_when_prerequisites_not_met": "false",
|
||||
"o_grey_when_prerequisites_not_met": "true",
|
||||
"o_text_when_prerequisites_not_met": "o_1 notmet",
|
||||
"o_text_when_prerequisites_met": "o_1 met",
|
||||
"o_prerequisites": {
|
||||
"p_1": {
|
||||
"p_id": "p_1",
|
||||
"p_type": "auto",
|
||||
"p_value": "5"
|
||||
}
|
||||
},
|
||||
"o_results": {
|
||||
"r_1": {
|
||||
"r_id": "r_1",
|
||||
"r_type": "dialog",
|
||||
"r_value": "2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"o_2": {
|
||||
"o_id": "o_2",
|
||||
"o_hide_when_prerequisites_not_met": "false",
|
||||
"o_grey_when_prerequisites_not_met": "true",
|
||||
"o_text_when_prerequisites_not_met": "o_2 notmet",
|
||||
"o_text_when_prerequisites_met": "o_2 met",
|
||||
"o_prerequisites": {
|
||||
"p_1": {
|
||||
"p_id": "p_1",
|
||||
"p_type": "auto",
|
||||
"p_value": "5"
|
||||
}
|
||||
},
|
||||
"o_results": {
|
||||
"r_1": {
|
||||
"r_id": "r_1",
|
||||
"r_type": "dialog",
|
||||
"r_value": "2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"o_3": {
|
||||
"o_id": "o_3",
|
||||
"o_hide_when_prerequisites_not_met": "false",
|
||||
"o_grey_when_prerequisites_not_met": "true",
|
||||
"o_text_when_prerequisites_not_met": "o3 notmet",
|
||||
"o_text_when_prerequisites_met": "o3 met",
|
||||
"o_prerequisites": {
|
||||
"p_1": {
|
||||
"p_id": "p_1",
|
||||
"p_type": "auto",
|
||||
"p_value": "5"
|
||||
}
|
||||
},
|
||||
"o_results": {
|
||||
"r_1": {
|
||||
"r_id": "r_1",
|
||||
"r_type": "dialog",
|
||||
"r_value": "2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1
dev/n_20.json
Normal file
@ -0,0 +1 @@
|
||||
{ "n_id": "n_12", "n_npc": "Mayor", "n_description": "The Mayor of Haven", "n_dialogs": { "d_1": { "d_id": "d_1", "d_type": "text", "d_text": "Hello Adventurer, I am the Mayor of Haven.", "d_options": { "o_1": { "o_id": "o_1", "o_hide_when_prerequisites_not_met": "false", "o_grey_when_prerequisites_not_met": "true", "o_text_when_prerequisites_not_met": "o_1 notmet", "o_text_when_prerequisites_met": "o_1 met", "o_prerequisites": { "p_1": { "p_id": "p_1", "p_type": "auto", "p_value": "5" } }, "o_results": { "r_1": { "r_id": "r_1", "r_type": "dialog", "r_value": "2" } } }, "o_2": { "o_id": "o_2", "o_hide_when_prerequisites_not_met": "false", "o_grey_when_prerequisites_not_met": "true", "o_text_when_prerequisites_not_met": "o_2 notmet", "o_text_when_prerequisites_met": "o_2 met", "o_prerequisites": { "p_1": { "p_id": "p_1", "p_type": "auto", "p_value": "5" } }, "o_results": { "r_1": { "r_id": "r_1", "r_type": "dialog", "r_value": "2" } } }, "o_3": { "o_id": "o_3", "o_hide_when_prerequisites_not_met": "false", "o_grey_when_prerequisites_not_met": "true", "o_text_when_prerequisites_not_met": "o3 notmet", "o_text_when_prerequisites_met": "o3 met", "o_prerequisites": { "p_1": { "p_id": "p_1", "p_type": "auto", "p_value": "5" } }, "o_results": { "r_1": { "r_id": "r_1", "r_type": "dialog", "r_value": "2" } } } } } } }
|
16
dev/whatdowedo.txt
Normal file
@ -0,0 +1,16 @@
|
||||
Next:
|
||||
|
||||
Bugfixes and executing functions when talked to
|
||||
|
||||
###
|
||||
|
||||
https://codeberg.org/Hamlet/mobs_humans/src/branch/master/init.lua
|
||||
https://github.com/minetest-mods/areas/blob/master/internal.lua
|
||||
https://forum.minetest.net/viewtopic.php?t=20379
|
||||
https://forum.minetest.net/viewtopic.php?t=19108
|
||||
|
||||
###
|
||||
|
||||
Make flat:
|
||||
|
||||
echo $(cat example.json) > n_12.json
|
2140
functions.lua
Normal file
28
init.lua
Normal file
@ -0,0 +1,28 @@
|
||||
yl_speak_up = {}
|
||||
|
||||
local modpath = minetest.get_modpath("yl_speak_up")..DIR_DELIM
|
||||
yl_speak_up.worldpath = minetest.get_worldpath()..DIR_DELIM
|
||||
yl_speak_up.modpath = modpath
|
||||
|
||||
yl_speak_up.modstorage = minetest.get_mod_storage()
|
||||
|
||||
-- status
|
||||
-- 0: NPCs may speak
|
||||
-- 1: NPCs may not speak
|
||||
-- 2: NPCs must selfdestruct on load. Their dialogs remain safed
|
||||
|
||||
yl_speak_up.status = yl_speak_up.modstorage:get_int("status") or 0
|
||||
yl_speak_up.number_of_npcs = yl_speak_up.modstorage:get_int("amount") or 0
|
||||
yl_speak_up.speak_to = {}
|
||||
|
||||
dofile(modpath .. "config.lua")
|
||||
dofile(modpath .. "privs.lua")
|
||||
dofile(modpath .. "functions.lua")
|
||||
dofile(modpath .. "tools.lua")
|
||||
dofile(modpath .. "mobs.lua")
|
||||
--dofile(modpath .. "debug.lua")
|
||||
|
||||
minetest.mkdir(yl_speak_up.worldpath..yl_speak_up.path)
|
||||
yl_speak_up.mob_table = yl_speak_up.init_mob_table() or {}
|
||||
|
||||
minetest.log("action","[MOD] yl_speak_up loaded")
|
333
mobs.lua
Normal file
@ -0,0 +1,333 @@
|
||||
mobs:register_mob("yl_speak_up:human", {
|
||||
type = "npc",
|
||||
passive = true,
|
||||
damage = 9,
|
||||
attack_type = "dogfight",
|
||||
attacks_monsters = true,
|
||||
attack_npcs = false,
|
||||
owner_loyal = false,
|
||||
pathfinding = false,
|
||||
hp_min = 60,
|
||||
hp_max = 100,
|
||||
armor = 0,
|
||||
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
||||
visual = "mesh",
|
||||
visual_size = {x = 1, y = 1},
|
||||
mesh = "skinsdb_3d_armor_character_5.b3d",
|
||||
drawtype = "front",
|
||||
textures = {{
|
||||
"blank.png", -- cape?
|
||||
"yl_speak_up_main_default.png", -- 64x64 skin
|
||||
"3d_armor_trans.png", -- shield?!
|
||||
"3d_armor_trans.png", -- item right hand
|
||||
}},
|
||||
makes_footstep_sound = true,
|
||||
sounds = {},
|
||||
walk_velocity = 2,
|
||||
run_velocity = 3,
|
||||
jump = false,
|
||||
water_damage = 0,
|
||||
lava_damage = 0,
|
||||
light_damage = 0,
|
||||
view_range = 4,
|
||||
owner = "Haven",
|
||||
order = "stand",
|
||||
fear_height = 3,
|
||||
animation = {
|
||||
speed_normal = 30,
|
||||
speed_run = 30,
|
||||
stand_start = 0,
|
||||
stand_end = 79,
|
||||
walk_start = 168,
|
||||
walk_end = 187,
|
||||
run_start = 168,
|
||||
run_end = 187,
|
||||
punch_start = 200,
|
||||
punch_end = 219,
|
||||
},
|
||||
|
||||
on_rightclick = yl_speak_up.on_rightclick,
|
||||
on_spawn = yl_speak_up.on_spawn,
|
||||
after_activate = yl_speak_up.after_activate
|
||||
})
|
||||
|
||||
mobs:register_egg("yl_speak_up:human", "Human", "wool_blue.png", 1)
|
||||
|
||||
mobs:register_mob("yl_speak_up:elf", {
|
||||
type = "npc",
|
||||
passive = true,
|
||||
damage = 9,
|
||||
attack_type = "dogfight",
|
||||
attacks_monsters = true,
|
||||
attack_npcs = false,
|
||||
owner_loyal = false,
|
||||
pathfinding = false,
|
||||
hp_min = 60,
|
||||
hp_max = 100,
|
||||
armor = 0,
|
||||
collisionbox = {-0.25, 0.0, -0.25, 0.25, 1.9, 0.25},
|
||||
visual = "mesh",
|
||||
visual_size = {x = 0.9, y = 1.1},
|
||||
mesh = "skinsdb_3d_armor_character_5.b3d",
|
||||
drawtype = "front",
|
||||
textures = {{
|
||||
"blank.png", -- cape?
|
||||
"yl_speak_up_main_default.png", -- 64x64 skin
|
||||
"3d_armor_trans.png", -- shield?!
|
||||
"3d_armor_trans.png", -- item right hand
|
||||
}},
|
||||
makes_footstep_sound = true,
|
||||
sounds = {},
|
||||
walk_velocity = 2,
|
||||
run_velocity = 3,
|
||||
jump = false,
|
||||
water_damage = 0,
|
||||
lava_damage = 0,
|
||||
light_damage = 0,
|
||||
view_range = 4,
|
||||
owner = "Haven",
|
||||
order = "stand",
|
||||
fear_height = 3,
|
||||
animation = {
|
||||
speed_normal = 30,
|
||||
speed_run = 30,
|
||||
stand_start = 0,
|
||||
stand_end = 79,
|
||||
walk_start = 168,
|
||||
walk_end = 187,
|
||||
run_start = 168,
|
||||
run_end = 187,
|
||||
punch_start = 200,
|
||||
punch_end = 219,
|
||||
},
|
||||
|
||||
on_rightclick = yl_speak_up.on_rightclick,
|
||||
on_spawn = yl_speak_up.on_spawn,
|
||||
after_activate = yl_speak_up.after_activate
|
||||
})
|
||||
|
||||
mobs:register_egg("yl_speak_up:elf", "Elf", "wool_cyan.png", 1)
|
||||
|
||||
mobs:register_mob("yl_speak_up:dwarf", {
|
||||
type = "npc",
|
||||
passive = true,
|
||||
damage = 9,
|
||||
attack_type = "dogfight",
|
||||
attacks_monsters = true,
|
||||
attack_npcs = false,
|
||||
owner_loyal = false,
|
||||
pathfinding = false,
|
||||
hp_min = 60,
|
||||
hp_max = 100,
|
||||
armor = 0,
|
||||
collisionbox = {-0.35, 0.0, -0.35, 0.35, 1.4, 0.35},
|
||||
visual = "mesh",
|
||||
visual_size = {x = 1.1, y = 0.8},
|
||||
mesh = "skinsdb_3d_armor_character_5.b3d",
|
||||
drawtype = "front",
|
||||
textures = {{
|
||||
"blank.png", -- cape?
|
||||
"yl_speak_up_main_default.png", -- 64x64 skin
|
||||
"3d_armor_trans.png", -- shield?!
|
||||
"3d_armor_trans.png", -- item right hand
|
||||
}},
|
||||
makes_footstep_sound = true,
|
||||
sounds = {},
|
||||
walk_velocity = 2,
|
||||
run_velocity = 3,
|
||||
jump = false,
|
||||
water_damage = 0,
|
||||
lava_damage = 0,
|
||||
light_damage = 0,
|
||||
view_range = 4,
|
||||
owner = "Haven",
|
||||
order = "stand",
|
||||
fear_height = 3,
|
||||
animation = {
|
||||
speed_normal = 30,
|
||||
speed_run = 30,
|
||||
stand_start = 0,
|
||||
stand_end = 79,
|
||||
walk_start = 168,
|
||||
walk_end = 187,
|
||||
run_start = 168,
|
||||
run_end = 187,
|
||||
punch_start = 200,
|
||||
punch_end = 219,
|
||||
},
|
||||
|
||||
on_rightclick = yl_speak_up.on_rightclick,
|
||||
on_spawn = yl_speak_up.on_spawn,
|
||||
after_activate = yl_speak_up.after_activate
|
||||
})
|
||||
|
||||
mobs:register_egg("yl_speak_up:dwarf", "Dwarf", "wool_red.png", 1)
|
||||
|
||||
mobs:register_mob("yl_speak_up:goblin", {
|
||||
type = "npc",
|
||||
passive = true,
|
||||
damage = 9,
|
||||
attack_type = "dogfight",
|
||||
attacks_monsters = true,
|
||||
attack_npcs = false,
|
||||
owner_loyal = false,
|
||||
pathfinding = false,
|
||||
hp_min = 60,
|
||||
hp_max = 100,
|
||||
armor = 0,
|
||||
collisionbox = {-0.25, 0.0, -0.25, 0.25, 1.4, 0.25},
|
||||
visual = "mesh",
|
||||
visual_size = {x = 0.7, y = 0.8},
|
||||
mesh = "skinsdb_3d_armor_character_5.b3d",
|
||||
drawtype = "front",
|
||||
textures = {{
|
||||
"blank.png", -- cape?
|
||||
"yl_speak_up_main_default.png", -- 64x64 skin
|
||||
"3d_armor_trans.png", -- shield?!
|
||||
"3d_armor_trans.png", -- item right hand
|
||||
}},
|
||||
makes_footstep_sound = true,
|
||||
sounds = {},
|
||||
walk_velocity = 2,
|
||||
run_velocity = 3,
|
||||
jump = false,
|
||||
water_damage = 0,
|
||||
lava_damage = 0,
|
||||
light_damage = 0,
|
||||
view_range = 4,
|
||||
owner = "Haven",
|
||||
order = "stand",
|
||||
fear_height = 3,
|
||||
animation = {
|
||||
speed_normal = 30,
|
||||
speed_run = 30,
|
||||
stand_start = 0,
|
||||
stand_end = 79,
|
||||
walk_start = 168,
|
||||
walk_end = 187,
|
||||
run_start = 168,
|
||||
run_end = 187,
|
||||
punch_start = 200,
|
||||
punch_end = 219,
|
||||
},
|
||||
|
||||
on_rightclick = yl_speak_up.on_rightclick,
|
||||
on_spawn = yl_speak_up.on_spawn,
|
||||
after_activate = yl_speak_up.after_activate
|
||||
})
|
||||
|
||||
mobs:register_egg("yl_speak_up:goblin", "Goblin", "wool_yellow.png", 1)
|
||||
|
||||
mobs:register_mob("yl_speak_up:orc", {
|
||||
type = "npc",
|
||||
passive = true,
|
||||
damage = 9,
|
||||
attack_type = "dogfight",
|
||||
attacks_monsters = true,
|
||||
attack_npcs = false,
|
||||
owner_loyal = false,
|
||||
pathfinding = false,
|
||||
hp_min = 60,
|
||||
hp_max = 100,
|
||||
armor = 0,
|
||||
collisionbox = {-0.35, 0.0, -0.35, 0.35, 1.9, 0.35},
|
||||
visual = "mesh",
|
||||
visual_size = {x = 1.1, y = 1.1},
|
||||
mesh = "skinsdb_3d_armor_character_5.b3d",
|
||||
drawtype = "front",
|
||||
textures = {{
|
||||
"blank.png", -- cape?
|
||||
"yl_speak_up_main_default.png", -- 64x64 skin
|
||||
"3d_armor_trans.png", -- shield?!
|
||||
"3d_armor_trans.png", -- item right hand
|
||||
}},
|
||||
makes_footstep_sound = true,
|
||||
sounds = {},
|
||||
walk_velocity = 2,
|
||||
run_velocity = 3,
|
||||
jump = false,
|
||||
water_damage = 0,
|
||||
lava_damage = 0,
|
||||
light_damage = 0,
|
||||
view_range = 4,
|
||||
owner = "Haven",
|
||||
order = "stand",
|
||||
fear_height = 3,
|
||||
animation = {
|
||||
speed_normal = 30,
|
||||
speed_run = 30,
|
||||
stand_start = 0,
|
||||
stand_end = 79,
|
||||
walk_start = 168,
|
||||
walk_end = 187,
|
||||
run_start = 168,
|
||||
run_end = 187,
|
||||
punch_start = 200,
|
||||
punch_end = 219,
|
||||
},
|
||||
|
||||
on_rightclick = yl_speak_up.on_rightclick,
|
||||
on_spawn = yl_speak_up.on_spawn,
|
||||
after_activate = yl_speak_up.after_activate
|
||||
})
|
||||
|
||||
mobs:register_egg("yl_speak_up:orc", "Orc", "wool_dark_green.png", 1)
|
||||
|
||||
-- ###
|
||||
-- Test
|
||||
-- ###
|
||||
|
||||
mobs:register_mob("yl_speak_up:npc", {
|
||||
type = "npc",
|
||||
passive = true,
|
||||
damage = 9,
|
||||
attack_type = "dogfight",
|
||||
attacks_monsters = true,
|
||||
attack_npcs = false,
|
||||
owner_loyal = false,
|
||||
pathfinding = false,
|
||||
hp_min = 60,
|
||||
hp_max = 100,
|
||||
armor = 0,
|
||||
collisionbox = {-0.35, 0.0, -0.35, 0.35, 1.9, 0.35},
|
||||
visual = "mesh",
|
||||
visual_size = {x = 1.1, y = 1.1},
|
||||
mesh = "skinsdb_3d_armor_character_5.b3d",
|
||||
drawtype = "front",
|
||||
textures = {{
|
||||
"blank.png", -- cape? wenn 64x32, dann 56,20 - 63,31, wenn 128x64, dann 111,39 - 127,63, rest invis
|
||||
"yl_speak_up_main_default.png", -- 64x64 skin oder auch 128x128?
|
||||
"blank.png", -- shield?! 64x32
|
||||
"3d_armor_trans.png", -- item right hand (16x16)
|
||||
}},
|
||||
makes_footstep_sound = true,
|
||||
sounds = {},
|
||||
walk_velocity = 2,
|
||||
run_velocity = 3,
|
||||
jump = false,
|
||||
water_damage = 0,
|
||||
lava_damage = 0,
|
||||
light_damage = 0,
|
||||
view_range = 4,
|
||||
owner = "Haven",
|
||||
order = "stand",
|
||||
fear_height = 3,
|
||||
animation = {
|
||||
speed_normal = 30,
|
||||
speed_run = 30,
|
||||
stand_start = 0,
|
||||
stand_end = 79,
|
||||
walk_start = 168,
|
||||
walk_end = 187,
|
||||
run_start = 168,
|
||||
run_end = 187,
|
||||
punch_start = 200,
|
||||
punch_end = 219,
|
||||
},
|
||||
|
||||
on_rightclick = yl_speak_up.on_rightclick,
|
||||
on_spawn = yl_speak_up.on_spawn,
|
||||
after_activate = yl_speak_up.after_activate
|
||||
})
|
||||
|
||||
mobs:register_egg("yl_speak_up:npc", "NPC", "wool_black.png", 1)
|
6
mod.conf
Normal file
@ -0,0 +1,6 @@
|
||||
author = Alias
|
||||
description = NPCs deliver speeches
|
||||
release = 202009231753
|
||||
title = Yourland Speak up
|
||||
name = yl_speak_up
|
||||
depends = mobs
|
BIN
models/skinsdb_3d_armor_character_5.b3d
Normal file
7
privs.lua
Normal file
@ -0,0 +1,7 @@
|
||||
local npc_master_priv_definition = {
|
||||
description="Can use the staffs to command NPCs",
|
||||
give_to_singleplayer = false,
|
||||
give_to_admin = true,
|
||||
}
|
||||
|
||||
minetest.register_privilege("npc_master", npc_master_priv_definition)
|
BIN
textures/3d_armor_trans.png
Normal file
After Width: | Height: | Size: 274 B |
BIN
textures/yl_npc_cape_default.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
textures/yl_speak_up_bg_dialog.png
Normal file
After Width: | Height: | Size: 146 B |
BIN
textures/yl_speak_up_bg_dialog_bl.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
textures/yl_speak_up_bg_dialog_br.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
textures/yl_speak_up_bg_dialog_hl.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
textures/yl_speak_up_bg_dialog_hr.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
textures/yl_speak_up_bg_dialog_tl.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
textures/yl_speak_up_bg_dialog_tr.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
textures/yl_speak_up_bg_dialog_vb.png
Normal file
After Width: | Height: | Size: 934 B |
BIN
textures/yl_speak_up_bg_dialog_vt.png
Normal file
After Width: | Height: | Size: 935 B |
BIN
textures/yl_speak_up_blank.png
Normal file
After Width: | Height: | Size: 165 B |
BIN
textures/yl_speak_up_cape_test.png
Normal file
After Width: | Height: | Size: 290 B |
BIN
textures/yl_speak_up_main_default.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
textures/yl_speak_up_mask_cape.png
Normal file
After Width: | Height: | Size: 214 B |
BIN
textures/yl_speak_up_mask_chest.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
textures/yl_speak_up_mask_head.png
Normal file
After Width: | Height: | Size: 139 B |
BIN
textures/yl_speak_up_mask_rarm.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
textures/yl_speak_up_mask_rleg.png
Normal file
After Width: | Height: | Size: 118 B |
BIN
textures/yl_speak_up_mask_shield.png
Normal file
After Width: | Height: | Size: 214 B |
BIN
textures/yl_speak_up_shield_test.png
Normal file
After Width: | Height: | Size: 207 B |
BIN
textures/yl_speak_up_staff_of_dawai_dawai.png
Normal file
After Width: | Height: | Size: 264 B |
BIN
textures/yl_speak_up_staff_of_fashion.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
textures/yl_speak_up_staff_of_game_over.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
textures/yl_speak_up_staff_of_i_said_so.png
Normal file
After Width: | Height: | Size: 263 B |
BIN
textures/yl_speak_up_staff_of_shut_up.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
textures/yl_speak_up_transform.png
Normal file
After Width: | Height: | Size: 191 B |
147
tools.lua
Normal file
@ -0,0 +1,147 @@
|
||||
minetest.register_tool("yl_speak_up:staff_of_i_said_so", {
|
||||
description = "Staff of I-said-so",
|
||||
inventory_image = "yl_speak_up_staff_of_i_said_so.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
||||
local has_priv = minetest.check_player_privs(user, {npc_master=true})
|
||||
local p_name = user:get_player_name()
|
||||
|
||||
if not has_priv then
|
||||
minetest.chat_send_player(p_name,yl_speak_up.message_tool_taken_because_of_lacking_priv)
|
||||
minetest.log("action","[MOD] yl_speak_up: User "..p_name.." used an admin item: "..itemstack:get_name().." at pos "..minetest.pos_to_string(user:get_pos(),0))
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if (pointed_thing.type == "object") then
|
||||
local obj = pointed_thing.ref
|
||||
local luaentity = obj:get_luaentity()
|
||||
|
||||
if luaentity ~= nil and luaentity.yl_speak_up == nil then return itemstack end -- Is the thing we clicked really one of our NPCs?
|
||||
|
||||
yl_speak_up.config(user, obj)
|
||||
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_tool("yl_speak_up:staff_of_shut_up", {
|
||||
description = "Staff of shut-up",
|
||||
inventory_image = "yl_speak_up_staff_of_shut_up.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
||||
local has_priv = minetest.check_player_privs(user, {npc_master=true})
|
||||
local p_name = user:get_player_name()
|
||||
|
||||
if not has_priv then
|
||||
minetest.chat_send_player(p_name,yl_speak_up.message_tool_taken_because_of_lacking_priv)
|
||||
minetest.log("action","[MOD] yl_speak_up: User "..p_name.." used an admin item: "..itemstack:get_name().." at pos "..minetest.pos_to_string(user:get_pos(),0))
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if (pointed_thing.type == "object") then
|
||||
local obj = pointed_thing.ref
|
||||
local luaentity = obj:get_luaentity()
|
||||
|
||||
if luaentity ~= nil and luaentity.yl_speak_up == nil then return itemstack end -- Is the thing we clicked really one of our NPCs?
|
||||
|
||||
luaentity.yl_speak_up.talk = false
|
||||
local npc = luaentity.yl_speak_up.id
|
||||
minetest.chat_send_player(p_name,"NPC with ID "..npc.." will shut up at pos "..minetest.pos_to_string(obj:get_pos(),0).." on command of "..p_name)
|
||||
minetest.log("action","[MOD] yl_speak_up: NPC with ID n_"..npc.." will shut up at pos "..minetest.pos_to_string(obj:get_pos(),0).." on command of "..p_name)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_tool("yl_speak_up:staff_of_dawai_dawai", {
|
||||
description = "Staff of dawai-dawai",
|
||||
inventory_image = "yl_speak_up_staff_of_dawai_dawai.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
||||
local has_priv = minetest.check_player_privs(user, {npc_master=true})
|
||||
local p_name = user:get_player_name()
|
||||
|
||||
if not has_priv then
|
||||
minetest.chat_send_player(p_name,yl_speak_up.message_tool_taken_because_of_lacking_priv)
|
||||
minetest.log("action","[MOD] yl_speak_up: User "..p_name.." used an admin item: "..itemstack:get_name().." at pos "..minetest.pos_to_string(user:get_pos(),0))
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if (pointed_thing.type == "object") then
|
||||
local obj = pointed_thing.ref
|
||||
local luaentity = obj:get_luaentity()
|
||||
|
||||
if luaentity ~= nil and luaentity.yl_speak_up == nil then return itemstack end -- Is the thing we clicked really one of our NPCs?
|
||||
|
||||
luaentity.yl_speak_up.talk = true
|
||||
local npc = luaentity.yl_speak_up.id
|
||||
minetest.chat_send_player(p_name,"NPC with ID "..npc.." will resume speech at pos "..minetest.pos_to_string(obj:get_pos(),0).." on command of "..p_name)
|
||||
minetest.log("action","[MOD] yl_speak_up: NPC with ID n_"..npc.." will resume speech at pos "..minetest.pos_to_string(obj:get_pos(),0).." on command of "..p_name)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_tool("yl_speak_up:staff_of_game_over", {
|
||||
description = "Staff of game-over",
|
||||
inventory_image = "yl_speak_up_staff_of_game_over.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
||||
local has_priv = minetest.check_player_privs(user, {npc_master=true})
|
||||
local p_name = user:get_player_name()
|
||||
|
||||
if not has_priv then
|
||||
minetest.chat_send_player(p_name,yl_speak_up.message_tool_taken_because_of_lacking_priv)
|
||||
minetest.log("action","[MOD] yl_speak_up: User "..p_name.." used an admin item: "..itemstack:get_name().." at pos "..minetest.pos_to_string(user:get_pos(),0))
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if (pointed_thing.type == "object") then
|
||||
local obj = pointed_thing.ref
|
||||
local luaentity = obj:get_luaentity()
|
||||
|
||||
if luaentity ~= nil and luaentity.yl_speak_up == nil then return itemstack end -- Is the thing we clicked really one of our NPCs?
|
||||
|
||||
local npc = luaentity.yl_speak_up.id
|
||||
minetest.chat_send_player(p_name,"NPC with ID "..npc.." removed from position "..minetest.pos_to_string(obj:get_pos(),0).." on command of "..p_name)
|
||||
minetest.log("action","[MOD] yl_speak_up: NPC with ID "..npc.." removed from position "..minetest.pos_to_string(obj:get_pos(),0).." on command of "..p_name)
|
||||
obj:remove()
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_tool("yl_speak_up:staff_of_fashion", {
|
||||
description = "Staff of fashion",
|
||||
inventory_image = "yl_speak_up_staff_of_fashion.png",
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
||||
local has_priv = minetest.check_player_privs(user, {npc_master=true})
|
||||
local p_name = user:get_player_name()
|
||||
|
||||
if not has_priv then
|
||||
minetest.chat_send_player(p_name,yl_speak_up.message_tool_taken_because_of_lacking_priv)
|
||||
minetest.log("action","[MOD] yl_speak_up: User "..p_name.." used an admin item: "..itemstack:get_name().." at pos "..minetest.pos_to_string(user:get_pos(),0))
|
||||
itemstack:take_item(1)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
if (pointed_thing.type == "object") then
|
||||
local obj = pointed_thing.ref
|
||||
local luaentity = obj:get_luaentity()
|
||||
|
||||
if luaentity ~= nil and luaentity.yl_speak_up == nil then return itemstack end -- Is the thing we clicked really one of our NPCs?
|
||||
|
||||
yl_speak_up.fashion(user, obj)
|
||||
local npc = luaentity.yl_speak_up.id
|
||||
minetest.chat_send_player(p_name,"NPC with ID n_"..npc.." will redress at pos "..minetest.pos_to_string(obj:get_pos(),0).." on command of "..p_name)
|
||||
minetest.log("action","[MOD] yl_speak_up: NPC with ID n_"..npc.." will redress at pos "..minetest.pos_to_string(obj:get_pos(),0).." on command of "..p_name)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
})
|