2014-07-26 22:52:25 +02:00
|
|
|
local ponnuki = {}
|
2010-08-08 09:40:42 +02:00
|
|
|
|
2014-07-26 22:52:25 +02:00
|
|
|
local directions = { "NW", "NO", "O", "SO", "SW", "W" }
|
|
|
|
local jokes = {
|
|
|
|
"Ein Bummerang ist, wenn man ihn wegwirft und er kommt nicht wieder, dann war's keiner.",
|
2010-08-08 09:40:42 +02:00
|
|
|
"Merke: Mit Schwabenwitzen soll man ganz sparsam sein.",
|
|
|
|
"Was bekommt man, wenn man Katzen und Elfen kreuzt? Elfen ohne Rheuma.",
|
|
|
|
"Was bekommt man, wenn man Insekten und Katzen kreuzt? Tiger, die Crisan benutzen."
|
2014-07-26 22:52:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
local function ponnuki_brain(u)
|
2010-08-08 09:40:42 +02:00
|
|
|
local i = math.random(table.getn(jokes))
|
2014-07-26 22:52:25 +02:00
|
|
|
u:add_notice("Eine Botschaft von " .. tostring(u) .. ": " ..jokes[i])
|
2010-08-08 09:40:42 +02:00
|
|
|
local d = math.random(6)
|
2014-07-26 22:52:25 +02:00
|
|
|
local r = u.region:next(d-1)
|
2010-08-08 09:40:42 +02:00
|
|
|
u:clear_orders()
|
|
|
|
u:add_order("NACH " .. directions[d])
|
|
|
|
end
|
|
|
|
|
2014-07-26 22:52:25 +02:00
|
|
|
function ponnuki.init()
|
|
|
|
-- initialize other scripts
|
|
|
|
local u = get_unit(atoi36("ponn"))
|
|
|
|
if not u then
|
|
|
|
eressea.log.error("Ponnuki is missing, will re-create")
|
|
|
|
local home = get_region(-67, -5)
|
|
|
|
local f = get_faction(666)
|
|
|
|
if home and f then
|
|
|
|
u = add_unit(f, home)
|
|
|
|
u.id = atoi36("ponn")
|
|
|
|
u.name = "Ponnuki"
|
|
|
|
u.info = "Go, Ponnuki, Go!"
|
|
|
|
u.race = "illusion"
|
|
|
|
u:set_racename("Ritter von Go")
|
|
|
|
else
|
|
|
|
eressea.log.error("Ponnuki cannot find Magrathea")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if u then
|
|
|
|
ponnuki_brain(u)
|
|
|
|
end
|
2010-08-08 09:40:42 +02:00
|
|
|
end
|
|
|
|
|
2014-07-26 22:52:25 +02:00
|
|
|
return ponnuki
|