File: main.lua

package info (click to toggle)
cataclysm-dda 0.C%2Bgit20190228.faafa3a-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 181,636 kB
  • sloc: cpp: 256,609; python: 2,621; makefile: 862; sh: 495; perl: 37; xml: 33
file content (21 lines) | stat: -rw-r--r-- 645 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
local MOD = {}

mods["ElfMod"] = MOD

function MOD.on_day_passed()
    game.add_msg("A day has passed! New elves are spawning!")

    -- spawn monster group in top left corner
    local overmap = g:get_cur_om()
    local newgroup = game.create_monster_group(overmap, "GROUP_ELF", 5, 5, 0, 10, 2000)
    newgroup.horde = true

    -- Elves multiply
    for _, mongroup in pairs(game.monstergroups(overmap)) do
        if mongroup.type == "GROUP_ELF" then
            mongroup.population = mongroup.population + 1
            game.add_msg("The elves multiply, oh noes! Current elf count: "..tostring(mongroup.population))
        end
    end
end