oh I forgot to commit for a while

master
archfan 2020-04-10 08:25:44 -04:00
parent 07b577aac9
commit d2484ceb3a
8 changed files with 129 additions and 20 deletions

View File

@ -5,3 +5,4 @@ local modpath = minetest.get_modpath(minetest.get_current_modname())
dofile(modpath.."/realm.lua")
dofile(modpath.."/items.lua")
dofile(modpath.."/mobs.lua")
dofile(modpath.."/nodes.lua")

View File

@ -24,3 +24,48 @@ minetest.register_craftitem("shadowrealm:escape_elixir", {
end,
on_drop = function() return end,
})
-- used to craft Asptooth Sword
minetest.register_craftitem("shadowrealm:asp_tooth", {
description = "Asp Tooth",
inventory_image = "shadowrealm_asp_tooth.png",
})
-- used to bait Gargantuan
minetest.register_craftitem("shadowrealm:asp_meat", {
description = "Asp Meat",
inventory_image = "shadowrealm_asp_meat.png",
})
-- obligatory item, but not usable as bait
minetest.register_craftitem("shadowrealm:asp_meat_cooked", {
description = "Cooked Asp Meat",
inventory_image = "shadowrealm_asp_meat_cooked.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
type = "cooking",
output = "shadowrealm:asp_meat_cooked",
recipe = "shadowrealm:asp_meat",
cooktime = 4,
})
-- used to bait Asp
minetest.register_craftitem("shadowrealm:carmelized_apple", {
description = "Carmelized Apple",
inventory_image = "shadowrealm_carmelized_apple.png",
on_use = minetest.item_eat(4),
})
minetest.register_craft({
type = "cooking",
output = "shadowrealm:carmelized_apple",
recipe = "default:apple",
cooktime = 4,
})
minetest.register_tool("shadowrealm:asptooth_sword", {
description = "Asptooth Sword",
inventory_image = "shadowrealm_asptooth_sword.png",
})

View File

@ -1,6 +1,37 @@
-- Using Termos' MobKit
-- Shadow Realm Mobs
local old_lq_jumpattack = mobkit.lq_jumpattack
-- utilizing examples from Lone_Wolf's Voxel Knights
--[[function mobkit.hq_attack(self,prty,tgtobj)
mobkit.lq_turn2pos(self, tgtobj:get_pos())
if self.attack_ok then
self.attack_ok = false
mobkit.animate(self, "leap")
tgtobj:punch(
self.object,
self.attack.interval,
self.attack,
vector.direction(self.object:get_pos(), tgtobj:get_pos())
)
minetest.after(self.attack.interval, function() self.attack_ok = true end)
end
end]]--
function mobkit.on_punch(self, puncher, time_from_last_punch, toolcaps, dir)
if puncher:is_player() then
self.puncher = puncher:get_player_name()
end
if toolcaps.damage_groups then
self.hp = self.hp - toolcaps.damage_groups.fleshy or 0
end
end
-- Asp
minetest.register_entity("shadowrealm:asp", {
initial_properties = {
@ -23,21 +54,19 @@ minetest.register_entity("shadowrealm:asp", {
if mobkit.timer(self,1) then
local prty = mobkit.get_queue_priority(self)
if prty < 10 then
local target = mobkit.get_nearby_player()
if prty < 20 then
local target = mobkit.get_nearby_player(self)
if target then
mobkit.hq_hunt(self, prty, target)
end
end
if mobkit.is_queue_empty_high(self) then
elseif mobkit.is_queue_empty_high(self) then
mobkit.hq_roam(self, prty)
end
end
end,
animation = {
walk = {range={x=1, y=10}, speed=24, loop=true},
leap = {range={x=11, y=31}, speed=24, loop=true},
leap = {range={x=11, y=31}, speed=24, loop=false},
},
sounds = {
hiss = "shadowrealm_hiss.ogg",
@ -48,3 +77,16 @@ minetest.register_entity("shadowrealm:asp", {
attack = {range = 2, damage_groups = {fleshy = 4}},
armor_groups = {fleshy = 5},
})
-- Entity which will carry the sparkle particlespawner
-- This will be invisible, but the particlespawners for
-- each mob will be attached to it.
-- Upon the mob being summoned to the real world, the sparkler
-- will be destroyed.
minetest.register_entity("shadowrealm:sparkler",
{
initial_properties = {
visual = "sprite",
is_visible = false,
},
})

View File

@ -1,3 +1,3 @@
name = shadowrealm
description = The realm of shadows contains many hidden horrors.
depends = mobkit
depends = mobkit, default

Binary file not shown.

Binary file not shown.

34
nodes.lua Normal file
View File

@ -0,0 +1,34 @@
-- Bait box
realm.baits = {
["shadowrealm:asp_meat"] = {"shadowrealm:gargantuan", "Gargantuan"},
["shadowrealm:carmelized_apple"] = {"shadowrealm:asp", "Asp"},
}
minetest.register_node("shadowrealm:bait_trap", {
description = "Bait Box",
tiles = {"shadowrealm_bait_trap.png"},
groups = {cracky=2},
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local name = itemstack:get_name()
if realm.baits[name] then
local timer = minetest.get_node_timer(pos)
if timer:is_started() then return end
local bait = realm.baits[name]
itemstack:take_item()
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Baited for "..realm.baits[name][2])
meta:set_string("bait", realm.baits[name][1])
timer:start(10)
end
return itemstack
end,
on_timer = function(pos, elapsed)
local timer = minetest.get_node_timer(pos)
timer:stop()
local meta = minetest.get_meta(pos)
local ent = meta:get_string("bait")
meta:set_string("infotext", "")
minetest.add_entity(pos, ent)
end
})

View File

@ -22,19 +22,6 @@ minetest.register_on_leaveplayer(function(player)
players[player:get_player_name()] = nil
end)
-- Entity which will carry the sparkle particlespawner
-- This will be invisible, but the particlespawners for
-- each mob will be attached to it.
-- Upon the mob being summoned to the real world, the sparkler
-- will be destroyed.
minetest.register_entity("shadowrealm:sparkler",
{
initial_properties = {
visual = "sprite",
is_visible = false,
},
})
-- Returns the particlespawner definition, attached to a provided
-- object, for use with minetest.add_particlespawner
realm.get_spawner_definition = function(object, playername)