Hi,
TPF fehlt es an Missionen. Endlich habe ich Zeit gefunden mich in das Thema einzuarbeiten.
Hier ein Vorgeschmack:
Das Video zeigt eine Mission die nichts anderes macht, als die Position eines Depots im gelben Kreis anzuzeigen. Das sind ja Infos die es braucht, um auf fremden Maps irgendwas zu lokalisieren.
Leider ist mir bis jetzt nicht bekannt, irgendwelchen Text irgendwohin auszugeben. Daher dieser Workaround.
Mod zum Download: http://momocat.de/gaming/tpf/mods/momocat_tc_1.zip
Ich habe auch mein Tooling soweit eingerichtet, dass ich relativ flott weiterarbeiten kann, sollte ich Zeit finden. Im Idealfall werden sogar Lexikonartikel entstehen, dann aber eher für TPF2. Ich hoffe von UG noch Schreibrechte fürs Wiki zu erhalten ( @tomdotio), um dort Dinge zu dokumentieren.
Mfg,
Momocat
Zum Schluss noch die Mission
local TaskManager = require "TaskManager"
local missionutil = require "missionutil"
local function makeIntroTask(doneFn)
local info = {
name = _("Dummy Task"),
paragraphs = {
{ text = "Build a depot and check it's corrdinates. Delete it afterwards and build a new one." },
},
}
local function fn(taskManager, task)
task.setCompleted()
doneFn(taskManager)
end
info.options = { { _("End Mission!"), fn } }
info.optionsRightAlign = true
local task = missionutil.makeTask(info)
task.setProgressNone()
return task
end
local function makeListenTaskX(doneFn)
local info = {
name = _("X"),
paragraphs = {
{ text = "Listen X" },
{ type = "TASK", text = _("Pos X") }
},
}
local task = missionutil.makeTask(info)
task.init = function(taskManager, data)
local centerPoly = missionutil.makeCircleZone({0,0},2000)
local centerZone = {polygon = centerPoly, draw = true, drawColor = missionutil.colors.YELLOW}
taskManager:setZone("center",centerZone)
task.setProgressCount(0, 20000)
end
task.update = function(taskManager)
local depotList = game.interface.getEntities({pos={0,0},radius=2000}, {type = "VEHICLE_DEPOT"} )
if #depotList == 0 then
task.setProgressCount(0, 20000)
return
end
for i = 1, #depotList do
local depot = game.interface.getEntity(depotList[i])
local x = depot.position[1]
task.setProgressCount(x, 20000)
end
end
return task
end
local function makeListenTaskY(doneFn)
local info = {
name = _("Y"),
paragraphs = {
{ text = "Listen Y" },
{ type = "TASK", text = _("Pos Y") }
},
}
local task = missionutil.makeTask(info)
task.init = function(taskManager, data)
task.setProgressCount(0, 20000)
end
task.update = function(taskManager)
local depotList = game.interface.getEntities({pos={0,0},radius=2000}, {type = "VEHICLE_DEPOT"} )
if #depotList == 0 then
task.setProgressCount(0, 20000)
return
end
for i = 1, #depotList do
local depot = game.interface.getEntity(depotList[i])
local y = depot.position[2]
task.setProgressCount(y, 20000)
end
end
return task
end
local function makeMissionComplete(label)
local info = {
title = _("Mission completed!"),
name = _("Mission completed!"),
description = _("It's finally done!")
}
local function fn(taskManager, task)
missionutil.completeAllTasks(taskManager)
end
local task = missionutil.makeMissionCompleteTask(info, fn)
return task
end
function data()
local tm = TaskManager.new()
tm:register("messageIntro", makeIntroTask, missionutil.addTask("missionComplete"))
tm:register("missionListenX", makeListenTaskX, missionutil.addTask("missionComplete"))
tm:register("missionListenY", makeListenTaskY, missionutil.addTask("missionComplete"))
tm:register("missionComplete", makeMissionComplete)
local mission = missionutil.makeMissionInterface(tm)
mission.onInit(function()
tm:add("messageIntro")
tm:add("missionListenX")
tm:add("missionListenY")
end)
return mission
end
Alles anzeigen