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