This commit is contained in:
cale 2016-03-13 15:59:30 +01:00
parent 012bb6afe2
commit 6be487acb9
7 changed files with 73 additions and 7 deletions

View File

@ -167,9 +167,20 @@ function story.generator.run(part, player, line_pos)
if cmd[1] == "$create" then
story.generator.show(player, story.generator.players_storys[player:get_player_name()].pos)
end
if cmd[1] == "$place" and cmd[2] then
if places.pos[cmd[2]] then
story.generator.players_storys[player:get_player_name()].pos = places.pos[cmd[2]]
if cmd[1] == "$place" and cmd[2] and cmd[3] then
if cmd[2] == "at" then
if places.pos[cmd[3]] then
story.generator.players_storys[player:get_player_name()].pos = places.pos[cmd[3]]
end
elseif cmd[2] == "near" then
if places.pos[cmd[3]] then
local place = places.pos[cmd[3]]
story.generator.players_storys[player:get_player_name()].pos = {x=place.x+math.random(-5, 5), y=place.y, z=place.z+math.random(-5, 5)}
end
else
if places.pos[cmd[3]] then
story.generator.players_storys[player:get_player_name()].pos = places.pos[cmd[3]]
end
end
end
if cmd[1] == "$quest" and cmd[2] and cmd[3] and cmd[4] and cmd[5] and tonumber(cmd[4]) and tonumber(cmd[5]) then
@ -186,7 +197,29 @@ function story.generator.run(part, player, line_pos)
story.generator.players_storys[player:get_player_name()].pos = {x=0,y=10,z=0}
end
if cmd[1] == "$next" and cmd[2] then
out = {part=cmd[2], wait=false}
if cmd[2] == "rnd" then
if cmd[3] and cmd[4] and cmd[5] then
local rnd = math.random(3)
if rnd == 1 then
out = {part=cmd[3], wait=false}
elseif rnd == 2 then
out = {part=cmd[4], wait=false}
else
out = {part=cmd[5], wait=false}
end
elseif cmd[3] and cmd[4] then
local rnd = math.random(2)
if rnd == 1 then
out = {part=cmd[3], wait=false}
else
out = {part=cmd[4], wait=false}
end
else
out = {part=cmd[3], wait=false}
end
else
out = {part=cmd[2], wait=false}
end
end
if cmd[1] == "$wait" then
return {cmd="$wait", param=i, wait=true}

View File

@ -1,5 +1,13 @@
$dialog test
$place home
$dialog welcome
$place near village_1
$create
$wait
$quest dignode default:grass 10 39
$dialog welcome_1
$place at village_1
$create
$wait
$dialog quest_1
$place near village_1
$create
$wait
$quest dignode farming:wheat_5 20 10

View File

@ -0,0 +1,4 @@
Farmer : Hi :)
Farmer : Could you help me?
You : Yes why not? What should I do?
Farmer : Get 20 wheat for me, please.

View File

@ -0,0 +1,4 @@
cdqwertz : Hello, welcome to RPGtest, a open source sandbox survival mmorpg!
You : hi :)
cdqwertz : Select your class using /class warrior/farmer/thief

View File

@ -0,0 +1,3 @@
cdqwertz : ok, now you can select a kit using /kit basic/hard
You : ok
cdqwertz : and now, have fun :)

0
mods/village/depends.txt Normal file
View File

View File

@ -1,5 +1,6 @@
village = {}
village.houses = {}
village.num = 1
function village.facedir_to_text_1(f)
local all = {[0]="0",[3]="90",[2]="180",[1]="270",[4]="360"}
@ -77,5 +78,18 @@ minetest.register_abm({
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.set_node(pos, {name = "air"})
village.gen(pos)
if not places.pos["village_" .. tostring(village.num)] then
places.pos["village_" .. tostring(village.num)] = {x=pos.x, y=pos.y, z=pos.z}
village.num = village.num +1
places.save_places()
else
-- TODO : save village num
village.num = village.num +10
if not places.pos["village_" .. tostring(village.num)] then
places.pos["village_" .. tostring(village.num)] = {x=pos.x, y=pos.y, z=pos.z}
village.num = village.num +1
places.save_places()
end
end
end,
})