-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add NPCs and make way for quest system
- Loading branch information
1 parent
63b0774
commit b493844
Showing
12 changed files
with
597 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
local modname = minetest.get_current_modname() | ||
|
||
local default_hit_replies = { | ||
"Keep your weapons to yourself", | ||
"Stop that", | ||
"Do I need to call a guard?", | ||
"Are you done or are you going to wear yourself out doing that?", | ||
"Didn't your parents tell you not to attack strangers?", | ||
"I can hit back too you know", | ||
"Enough!", | ||
"Go practice that somewhere else", | ||
} | ||
|
||
local function prettify(npcname) | ||
local output = npcname:gsub("_", " ") | ||
|
||
return output:gsub("^(.)", string.upper) | ||
end | ||
|
||
local function register_npc(name, def) | ||
minetest.register_node(modname..":"..name, { | ||
description = "NPC "..prettify(name), | ||
drawtype = "mesh", | ||
mesh = "player.obj", | ||
visual_scale = 0.093, | ||
wield_scale = vector.new(0.093, 0.093, 0.093), | ||
tiles = {def.texture}, | ||
paramtype = "light", | ||
paramtype2 = "facedir", | ||
selection_box = { | ||
type = "fixed", | ||
fixed = { | ||
{-0.45, -0.5, -0.25, 0.45, 1.45, 0.25}, | ||
} | ||
}, | ||
collision_box = { | ||
type = "fixed", | ||
fixed = { | ||
{-0.45, -0.5, -0.25, 0.45, 1.45, 0.25}, | ||
} | ||
}, | ||
groups = {unbreakable = 1, loadme = 1, overrides_pointable = 1}, | ||
on_construct = function(pos) | ||
|
||
end, | ||
on_punch = function(pos, node, puncher, ...) | ||
if def.on_punch and def.on_punch(pos, node, puncher, ...) then | ||
return | ||
end | ||
|
||
if def.hit_replies and puncher and puncher:is_player() then | ||
minetest.chat_send_player(puncher:get_player_name(), ("<%s> "):format(prettify(name))..def.hit_replies[math.random(1, #def.hit_replies)]) | ||
end | ||
end, | ||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) | ||
if not clicker or not clicker:is_player() then return end | ||
|
||
local formspec = ([[ | ||
size[8,6] | ||
real_coordinates[true] | ||
label[0.2,0.3;%s] | ||
]]):format( | ||
prettify(name) | ||
) | ||
|
||
if not def.convos then | ||
minetest.chat_send_player(clicker:get_player_name(), ("<%s> "):format(prettify(name)).."I have nothing to say") | ||
return | ||
end | ||
|
||
minetest.show_formspec(clicker:get_player_name(), "npcform", formspec) | ||
end | ||
}) | ||
end | ||
|
||
register_npc("blacksmith", { | ||
texture = "vk_npcs_blacksmith.png", | ||
hit_replies = default_hit_replies, | ||
}) | ||
|
||
register_npc("stable_man", { | ||
texture = "vk_npcs_stable_man.png", | ||
hit_replies = default_hit_replies, | ||
}) | ||
|
||
register_npc("guard", { | ||
texture = "vk_npcs_guard.png", | ||
hit_replies = default_hit_replies, | ||
}) | ||
|
||
register_npc("tavern_keeper", { | ||
texture = "vk_npcs_tavern_keeper.png", | ||
hit_replies = default_hit_replies, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
name = vk_npcs | ||
depends = vk_mapgen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Blender MTL File: 'player.blend' | ||
# Material Count: 1 | ||
|
||
newmtl Material | ||
Ns 225.000000 | ||
Ka 1.000000 1.000000 1.000000 | ||
Kd 0.800000 0.800000 0.800000 | ||
Ks 0.500000 0.500000 0.500000 | ||
Ke 0.000000 0.000000 0.000000 | ||
Ni 1.000000 | ||
d 1.000000 | ||
illum 2 |
Oops, something went wrong.