forked from github/server
Christmas update: we celebrate Knut.
This commit is contained in:
parent
27110e7e26
commit
fa6192daf9
2 changed files with 12 additions and 5 deletions
|
@ -226,10 +226,10 @@ is_function(struct lua_State * luaState, const char * fname)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
get_season(void)
|
get_season(int turnno)
|
||||||
{
|
{
|
||||||
gamedate gd;
|
gamedate gd;
|
||||||
get_gamedate(turn, &gd);
|
get_gamedate(turnno, &gd);
|
||||||
return seasonnames[gd.season];
|
return seasonnames[gd.season];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
function use_xmastree(u, amount)
|
function use_xmastree(u, amount)
|
||||||
u.region:set_key("xm06", true)
|
u.region:set_key("xm06", true)
|
||||||
u:use_pooled("xmastree", amount)
|
u:use_pooled("xmastree", amount)
|
||||||
msg = message("usepotion")
|
local msg = message("usepotion")
|
||||||
msg:set_unit("unit", u)
|
msg:set_unit("unit", u)
|
||||||
msg:set_resource("potion", "xmastree")
|
msg:set_resource("potion", "xmastree")
|
||||||
msg:send_region(u.region)
|
msg:send_region(u.region)
|
||||||
|
@ -9,10 +9,13 @@ function use_xmastree(u, amount)
|
||||||
end
|
end
|
||||||
|
|
||||||
function update_xmas2006()
|
function update_xmas2006()
|
||||||
season = get_season()
|
local turn = get_turn()
|
||||||
|
local season = get_season(turn)
|
||||||
if season == "calendar::winter" then
|
if season == "calendar::winter" then
|
||||||
print("it is " .. season .. ", the christmas trees do their magic")
|
print("it is " .. season .. ", the christmas trees do their magic")
|
||||||
msg = message("xmastree_effect")
|
local msg = message("xmastree_effect")
|
||||||
|
local nextseason = get_season(turn-1)
|
||||||
|
local clear = (nextseason ~= "calendar::winter")
|
||||||
for r in regions() do
|
for r in regions() do
|
||||||
if r:get_key("xm06") then
|
if r:get_key("xm06") then
|
||||||
trees = r:get_resource("tree")
|
trees = r:get_resource("tree")
|
||||||
|
@ -20,6 +23,10 @@ function update_xmas2006()
|
||||||
r:set_resource("tree", trees * 1.1)
|
r:set_resource("tree", trees * 1.1)
|
||||||
msg:send_region(r)
|
msg:send_region(r)
|
||||||
end
|
end
|
||||||
|
if clear then
|
||||||
|
-- we celebrate knut and kick out the trees.
|
||||||
|
r:set_key("xm06", false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue