From 9bec96f2f286d990e610194a7bdd157e19c29a4d Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Sun, 23 May 2021 06:49:52 -0700 Subject: [PATCH] Add WIP code --- CHANGES.txt | 0 LICENSE.txt | 21 +++++++++++++++++++++ README.md | 27 +++++++++++++++++++++++++++ TODO.txt | 5 +++++ entity.lua | 0 init.lua | 29 +++++++++++++++++++++++++++++ mod.conf | 6 ++++++ settings.lua | 24 ++++++++++++++++++++++++ settingtypes.txt | 18 ++++++++++++++++++ 9 files changed, 130 insertions(+) create mode 100644 CHANGES.txt create mode 100644 LICENSE.txt create mode 100644 README.md create mode 100644 TODO.txt create mode 100644 entity.lua create mode 100644 init.lua create mode 100644 mod.conf create mode 100644 settings.lua create mode 100644 settingtypes.txt diff --git a/CHANGES.txt b/CHANGES.txt new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..357bcd0 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright © 2021 Jordan Irwin (AntumDeluge) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..876954d --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +## Skeleton for Minetest + +### Description: + +A skeleton mob using the [cmer][] (Creatures Revived) API. + +***Status:** currently not functional* + +### Licensing: + +- Code: [MIT](LICENSE.txt) + +### Requirements: + +Depends: [cmer][], [cmer_zombie][] + +Optional depends: [asm_spawneggs][] + +### Links: + +- [Changelog](CHANGES.txt) +- [TODO](TODO.txt) + + +[cmer]: https://forum.minetest.net/viewtopic.php?t=26684 +[cmer_zombie]: https://github.com/AntumMT/mod-cmer/tree/zombie +[asm_spawneggs]: https://content.minetest.net/packages/AntumDeluge/asm_spawneggs/ diff --git a/TODO.txt b/TODO.txt new file mode 100644 index 0000000..22d7d2d --- /dev/null +++ b/TODO.txt @@ -0,0 +1,5 @@ + +TODO: +- register skeleton entity with cmer +- register egg with asm_spawneggs +- add bone item diff --git a/entity.lua b/entity.lua new file mode 100644 index 0000000..e69de29 diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..6bf351a --- /dev/null +++ b/init.lua @@ -0,0 +1,29 @@ + +cmer_skeleton = {} +cmer_skeleton.modname = core.get_current.modname() +cmer_skeleton.modpath = core.get_modpath(cmer_skeleton.modname) + +function cmer_skeleton.log(lvl, msg) + if not msg then + msg = lvl + lvl = nil + end + + msg = "[" .. cmer_skeleton.modname .. "] " .. msg + + if not lvl then + core.log(msg) + else + core.log(lvl, msg) + end +end + + +local scripts = { + "settings", + "entity", +} + +for _, script in ipairs(scripts) do + dofile(cmer_skeleton.modpath .. "/" .. script .. ".lua") +end diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..94f4d2e --- /dev/null +++ b/mod.conf @@ -0,0 +1,6 @@ +name = cmer_skeleton +title = Skeleton +description = A skeleton mob using the cmer API. +author = Jordan Irwin (AntumDeluge) +license = MIT +depends = cmer, cmer_zombie diff --git a/settings.lua b/settings.lua new file mode 100644 index 0000000..ad459ec --- /dev/null +++ b/settings.lua @@ -0,0 +1,24 @@ + +--- Entity lifespan. +-- +-- @setting skeleton.lifetime +-- @settype int +-- @default 300 +cmer_skeleton.lifetime = tonumber(core.settings:get("skeleton.lifetime")) or 300 + +--- Spawn rate frequency. +-- +-- +-- @setting skeleton.spawn_interval +-- @settype int +-- @default 600 (10 minutes) +-- @see [ABM definition](http://minetest.gitlab.io/minetest/definition-tables.html#abm-activeblockmodifier-definition) +cmer_skeleton.spawn_interval = tonumber(core.settings:get("skeleton.spawn_interval")) or 10 * 60 + +--- Chance of spawn at interval. +-- +-- @setting skeleton.spawn_chance +-- @settype int +-- @default 9000 +-- @see [ABM definition](http://minetest.gitlab.io/minetest/definition-tables.html#abm-activeblockmodifier-definition) +cmer_skeleton.spawn_chance = tonumber(core.settings:get("skeleton.spawn_chance")) or 9000 diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..ac8afab --- /dev/null +++ b/settingtypes.txt @@ -0,0 +1,18 @@ + +# Entity lifespan. +# +# type: int +# default: 300 +skeleton.lifetime (Lifespan) int 300 1 + +# Spawn interval in seconds. +# +# type: int +# default: 600 (10 minutes) +skeleton.spawn_interval (Spawn interval) int 600 1 + +# Chance of spawn at interval. +# +# type: int +# default: 9000 +skeleton.spawn_chance (Spawn chance) int 9000 1