From 8408271659f5ad24c43c67d5c9cb88c5147c0ea2 Mon Sep 17 00:00:00 2001 From: cale Date: Mon, 4 Jan 2016 13:00:19 +0100 Subject: [PATCH] Added License --- mods/quests/depends.txt | 1 + mods/quests/depends.txt~ | 1 + mods/story/api.lua | 10 ++++++- mods/story/api.lua~ | 10 ++++++- mods/story/init.lua | 25 +++++++++++++----- mods/story/init.lua~ | 25 +++++++++++++----- .../story/textures/story_set_conversation.png | Bin 0 -> 249 bytes 7 files changed, 58 insertions(+), 14 deletions(-) create mode 100644 mods/story/textures/story_set_conversation.png diff --git a/mods/quests/depends.txt b/mods/quests/depends.txt index 07f8b9f..355f0a1 100644 --- a/mods/quests/depends.txt +++ b/mods/quests/depends.txt @@ -1,2 +1,3 @@ default central_message +story diff --git a/mods/quests/depends.txt~ b/mods/quests/depends.txt~ index 07f8b9f..355f0a1 100644 --- a/mods/quests/depends.txt~ +++ b/mods/quests/depends.txt~ @@ -1,2 +1,3 @@ default central_message +story diff --git a/mods/story/api.lua b/mods/story/api.lua index 77df8ba..005615d 100644 --- a/mods/story/api.lua +++ b/mods/story/api.lua @@ -2,5 +2,13 @@ story.talk_form = "size[8,7.5;]" story.talk_form = story.talk_form..default.gui_colors story.talk_form = story.talk_form..default.gui_bg story.talk_form = story.talk_form.."image[0,0.0;3,8;story_player.png]" -story.talk_form = story.talk_form.."label[2.5,0;You : Hi\nCate : Hi, I have an quest for you!]" +story.talk_form = story.talk_form.."label[2.5,0;%s]" story.talk_form = story.talk_form.."image[6,0.0;3,8;story_character_1.png]" + +story.set_talk_form = function(pos, name, text) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", string.format(story.talk_form, text)) + meta:set_string("infotext", name) + local inv = meta:get_inventory() + inv:set_size("main", 8*4) +end diff --git a/mods/story/api.lua~ b/mods/story/api.lua~ index 77df8ba..005615d 100644 --- a/mods/story/api.lua~ +++ b/mods/story/api.lua~ @@ -2,5 +2,13 @@ story.talk_form = "size[8,7.5;]" story.talk_form = story.talk_form..default.gui_colors story.talk_form = story.talk_form..default.gui_bg story.talk_form = story.talk_form.."image[0,0.0;3,8;story_player.png]" -story.talk_form = story.talk_form.."label[2.5,0;You : Hi\nCate : Hi, I have an quest for you!]" +story.talk_form = story.talk_form.."label[2.5,0;%s]" story.talk_form = story.talk_form.."image[6,0.0;3,8;story_character_1.png]" + +story.set_talk_form = function(pos, name, text) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", string.format(story.talk_form, text)) + meta:set_string("infotext", name) + local inv = meta:get_inventory() + inv:set_size("main", 8*4) +end diff --git a/mods/story/init.lua b/mods/story/init.lua index 5d77c90..a0e17d8 100644 --- a/mods/story/init.lua +++ b/mods/story/init.lua @@ -8,15 +8,28 @@ minetest.register_node("story:character_static", { tiles = {"character.png"}, drawtype = "mesh", mesh = "character_static.obj", - groups = {crumbly = 3}, + groups = {story = 1, quests =1}, paramtype = "light", paramtype2 = "facedir", on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", story.talk_form) - meta:set_string("infotext", "Character") - local inv = meta:get_inventory() - inv:set_size("main", 8*4) + story.set_talk_form(pos, "Character", "") + end, + +}) + +minetest.register_craftitem("story:conversation", { + description = "Set Conversation", + inventory_image = "story_set_conversation.png", + on_place = function(itemstack, placer, pointed_thing) + if not placer or not placer:is_player() then + return + end + if not pointed_thing or not pointed_thing.under then + return + end + story.set_talk_form(pointed_thing.under) end, }) + + diff --git a/mods/story/init.lua~ b/mods/story/init.lua~ index 5d77c90..a0e17d8 100644 --- a/mods/story/init.lua~ +++ b/mods/story/init.lua~ @@ -8,15 +8,28 @@ minetest.register_node("story:character_static", { tiles = {"character.png"}, drawtype = "mesh", mesh = "character_static.obj", - groups = {crumbly = 3}, + groups = {story = 1, quests =1}, paramtype = "light", paramtype2 = "facedir", on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", story.talk_form) - meta:set_string("infotext", "Character") - local inv = meta:get_inventory() - inv:set_size("main", 8*4) + story.set_talk_form(pos, "Character", "") + end, + +}) + +minetest.register_craftitem("story:conversation", { + description = "Set Conversation", + inventory_image = "story_set_conversation.png", + on_place = function(itemstack, placer, pointed_thing) + if not placer or not placer:is_player() then + return + end + if not pointed_thing or not pointed_thing.under then + return + end + story.set_talk_form(pointed_thing.under) end, }) + + diff --git a/mods/story/textures/story_set_conversation.png b/mods/story/textures/story_set_conversation.png new file mode 100644 index 0000000000000000000000000000000000000000..7f53666e2ed8c889d8b32254f9f48951093ebb85 GIT binary patch literal 249 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>{XE z)7O>#0V4~y8Fv-uikm&vz-P&=AHOcRs-=M>+pbO;wcu0VXah2~Q)2`DsmT0+)KOGbEWjHfe}B8^NpKYTU-SB+JdPLFQ}$ k^NFiG{+&;