New Wands!

master
francisco athens 2020-08-01 15:46:04 -07:00
parent dff940843a
commit 87f8244cd3
7 changed files with 391 additions and 311 deletions

View File

@ -1,4 +1,5 @@
2020/07/31: Witches can turn aggressive mobs into sheep!
2020/08/01: Witches have two new wands from Damon and Simone!
2020/07/31: Witches can turn aggressive mobs into sheep! Witches gain drench spell!
2020/07/28: Witches will teleport you away from themselves if you are aggressive!
2020/07/26: Witch cottage placement refactor and settings menu options!
2020/07/25: Witch cottages refinements (thanks Solomine!)

307
init.lua
View File

@ -5,7 +5,7 @@
local path = minetest.get_modpath("witches")
witches = {}
witches.version = "20200731"
witches.version = "20200801"
print("this is Witches "..witches.version)
-- Strips any kind of escape codes (translation, colors) from a string
@ -71,309 +71,12 @@ else
dofile(path .. "/basic_houses.lua")
print("handle_schematics found! Witch cottages enabled!")
end
dofile(path .. "/witches.lua")
print("enter the witches! version: "..witches.version)
local variance = witches.variance
local rnd_color = witches.rnd_color
local rnd_colors = witches.rnd_colors
local hair_colors = witches.hair_colors
local spawning = {
cottage = {
nodes = {"group:wood","default:mossycobble","default:cobble"},
neighbors = {"air","default:chest","doors:wood_witch_a"},
min_light = 5,
max_light = 15,
interval = 30,
chance = 10,
active_object_count = 2,
min_height = 0,
max_height = 200,
day_toggle = nil,
on_spawn = function(self)
local pos = self.object:get_pos()
print(self.secret_name.." spawned at ".. minetest.pos_to_string(vector.round(pos)))
end,
},
generic = {
nodes = {"group:wood","default:mossycobble","default:cobble"},
neighbors = {"air","default:chest"},
min_light = 5,
max_light = 15,
interval = 300,
chance = 10,
active_object_count = 1,
min_height = 0,
max_height = 200,
day_toggle = nil,
on_spawn = function(self)
local pos = self.object:get_pos()
print(self.secret_name.." spawned at ".. minetest.pos_to_string(vector.round(pos)))
end
}
}
local witch_types = {
generic = {
description = "Wanderling",
lore = "This witch wanders about the land, for what do they seek?",
additional_properties = {
special_follow = {"default:diamond", "default:gold_lump", "default:apple",
"default:blueberries", "default:torch", "default:stick",
"flowers:mushroom_brown","flowers:mushroom_red"},
do_custom_addendum = function(self)
if math.random() < .0001 and minetest.registered_nodes["fireflies:firefly"] then
local pos = self.object:get_pos()
pos.y = pos.y+1
local pos1 = minetest.find_node_near(pos, 3, "air")
minetest.set_node(pos1, {name = "fireflies:firefly"})
--print("setting firefly"..minetest.pos_to_string(pos1))
end
end,
on_spawn_addendum = function(self)
--print(dump(self.drops).."and"..dump(minetest.registered_tools))
witches.firefly_mod(self)
end
}
},
cottage = {
description = "Eremitant",
lore = "This witch has found a home for themselves, who would bother them?",
additional_properties = {
special_follow = {"default:diamond", "default:gold_lump", "default:apple",
"default:blueberries", "default:torch", "default:stick",
"flowers:mushroom_brown","flowers:mushroom_red"},
do_custom_addendum = function(self)
end,
on_spawn_addendum = function(self)
witches.claim_witches_chest(self)
end
},
spawning = spawning.cottage,
}
}
local witch_template = { --your average witch,
description = "Basic Witch",
lore = "This witch has a story yet to be...",
type = "npc",
passive = false,
attack_type = "dogfight",
attack_monsters = true,
attack_npcs = false,
attack_players = true,
group_attack = true,
runaway = false,
damage = 1,
reach = 2,
knock_back = true,
hp_min = 5,
hp_max = 10,
armor = 100,
visual = "mesh",
mesh = "witches_witch.b3d",
textures = {
"witches_clothes.png"
},
--blood_texture = "witches_blood.png",
collisionbox = {-0.25, 0, -.25, 0.25, 2, 0.25},
drawtype = "front",
makes_footstep_sound = true,
sounds = {
random = "",
war_cry = "",
attack = "",
damage = "",
death = "",
replace = "", gain = 0.05,
distance = 15},
teleport = "witches_magic01",
polymorph = "witches_magic02",
walk_velocity = 2,
run_velocity = 3,
pathfinding = 1,
jump = true,
jump_height = 5,
step_height = 1.5,
fear_height = 4,
water_damage = 0,
lava_damage = 2,
light_damage = 0,
lifetimer = 360,
view_range = 10,
stay_near = "",
order = "follow",
animation = {
stand_speed = 30,
stand_start = 0,
stand_end = 80,
walk_speed = 30,
walk_start = 168,
walk_end = 187,
run_speed = 45,
run_start = 168,
run_end = 187,
punch_speed = 30,
punch_start = 200,
punch_end = 219,
},
drops = {
{name = "default:pick_steel",
chance = 1000, min = 0, max = 1},
{name = "default:shovel_steel",
chance = 1000, min = 0, max = 1},
{name = "default:axe_steel",
chance = 1000, min = 0, max = 1},
{name = "default:axe_stone",
chance = 5, min = 0, max = 1},
},
follow = {
},
additional_properties = {
special_follow = {"default:diamond", "default:gold_lump", "default:apple",
"default:blueberries", "default:torch", "default:stick",
"flowers:mushroom_brown","flowers:mushroom_red"},
},
on_rightclick = function(self,clicker)
witches.quests(self,clicker)
end,
do_custom = function(self)
if self.do_custom_addendum then
self.do_custom_addendum(self)
end
if self.attack then
local s = self.object:get_pos()
local objs = minetest.get_objects_inside_radius(s, 2)
for n = 1, #objs do
local ent = objs[n]:get_luaentity()
if objs[n] == self.attack then
if self.attack:is_player() then
-- witches.magic.banish_underground(self,objs[n],10)
witches.magic.teleport(self,objs[n],math.random(3,8),math.random(2,4))
else
if math.random() < 0.2 then
witches.magic.teleport(self,objs[n],math.random(3,5),math.random(2,4))
witches.magic.polymorph(self,objs[n])
elseif math.random() <.5 then
witches.magic.teleport(self,objs[n],math.random(3,5),math.random(1,2))
witches.magic.splash(self,objs[n],{x=2,y=2,z=2},math.random(0,1))
-- witches.magic.splash(self,target,volume,height,node)
else
witches.magic.teleport(self,objs[n],math.random(3,8),math.random(2,4))
end
-- witches.magic.teleport(self,objs[n],math.random(3,8),math.random(2,4))
end
end
end
end
end,
on_spawn = function(self)
--make sure these are baseline on spawn
--self.animation.walk_speed = 30
--self.animation.run_speed = 45
--self.walk_velocity = 2
--self.run_velocity = 3
--then set modifiers for each individual
if not self.speed_mod then
self.speed_mod = math.random(-1, 1)
end
--print("speed mod: "..self.speed_mod)
--rng for testing variants
if not self.size then
self.size = {x = variance(90,100), y = variance(75,105), z = variance(90,100)}
end
if not self.skin then
self.skin = math.random(1,5)
end
if not self.color_mod then
self.color_mod = rnd_color(rnd_colors)
end
if not self.hair_color then
self.hair_color= rnd_color(hair_colors)
end
local self_properties = self.object:get_properties()
self_properties.visual_size = self.size
self.object:set_properties(self_properties)
--initial speed modifications
self.walk_velocity = self.walk_velocity + ( self.speed_mod / 10 )
self.run_velocity = self.run_velocity + ( self.speed_mod / 10 )
self.animation.walk_speed = self.animation.walk_speed + self.speed_mod
self.animation.run_speed = self.animation.run_speed + self.speed_mod
--no more speed mods!
self.speed_mod = 0
-- so many overlays!
if self.color_mod ~="none" then
self.object:set_texture_mod("^[colorize:"..self.color_mod..":60^witches_skin"..self.skin..".png^witches_accessories.png^witches_witch_hair_"..self.hair_color..".png")
else
self.object:set_texture_mod("^witches_skin"..self.skin..".png^witches_accessories.png^witches_witch_hair_"..self.hair_color..".png")
end
if not self.secret_name then
self.secret_name = witches.generate_text(witches.name_parts_female)
end
if not self.secret_title then
self.secret_title = witches.generate_text(witches.words_desc, {"titles"})
end
if not self.secret_locale then
self.secret_locale = witches.generate_text(witches.name_parts_female, {"syllablesStart","syllablesEnd"})
end
--self.item_request.text = witches.generate_name(witches.quest_dialogs, {"item_request"})
--print(self.secret_name.." has spawned")
--print("self: "..dump(self.follow))
-- print("self properties "..dump(self.object:get_properties()))
--self.follow = {}
if not self.follow or #self.follow < 1 or type(self.follow) == string then
self.follow = {}
table.insert(self.follow,self.special_follow[math.random(#self.special_follow)])
end
if self.on_spawn_addendum then
self.on_spawn_addendum(self)
end
witches.looking_for(self)
end,
spawning = spawning.generic,
after_activate = function(self)
--maddest hatter <|%\D
self.hair_style = math.random(1,#witches.witch_hair_styles)
self.hat_style = math.random(1,#witches.witch_hat_styles)
witches.attach_hair(self,"witches:witch_hair_"..self.hair_style)
witches.attach_hat(self,"witches:witch_hat_"..self.hat_style)
witches.attach_tool(self,"witches:witch_tool")
end
}
--- This can build all the mobs in our mod.
-- @witch_types is a table with the key used to build the subtype with values that are unique to that subtype
@ -405,4 +108,4 @@ function witches.generate(witch_types,witch_template)
end
end
witches.generate(witch_types,witch_template)
witches.generate(witches.witch_types,witches.witch_template)

View File

@ -12,10 +12,10 @@ local hat_bling = {"band","feather","veil"}
local hair_bling = {}
--[[
minetest.register_tool("witches:witch_wand", {
description = "wand",
inventory_image = "witches_witch_wand.png",
minetest.register_tool("witches:witch_wand_sp", {
description = "Sparkle Parkle!",
inventory_image = "witches_wand_sparkle_parkle.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level=0,
@ -26,8 +26,71 @@ minetest.register_tool("witches:witch_wand", {
},
sound = {breaks = "default_tool_breaks"},
--groups = {pickaxe = 1}
})
--]]
local witch_tool_wand_sp = {}
witch_tool_wand_sp = {
initial_properties = {
--physical = true,
pointable = false,
collisionbox = {0,0,0,0,0,0},
visual = "wielditem",
visual_size = {x = 0.3, y = 0.3},
wield_item = "witches:witch_wand_sp",
},
on_step = function(self)
if not self.owner or not self.owner:get_luaentity() then
self.object:remove()
end
end
}
minetest.register_entity("witches:witch_tool_wand_sp",witch_tool_wand_sp)
minetest.register_tool("witches:witch_wand_btb", {
description = "Better Thank Bacon!",
inventory_image = "witches_wand_better_than_bacon.png",
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level=0,
groupcaps={
--cracky = {times={[2]=1.8, [3]=0.90}, uses=25, maxlevel=1},
},
damage_groups = {fleshy=3},
},
sound = {breaks = "default_tool_breaks"},
--groups = {pickaxe = 1}
})
local witch_tool_wand_btb = {}
witch_tool_wand_btb = {
initial_properties = {
--physical = true,
pointable = false,
collisionbox = {0,0,0,0,0,0},
visual = "wielditem",
visual_size = {x = 0.3, y = 0.3},
wield_item = "witches:witch_wand_btb",
},
on_step = function(self)
if not self.owner or not self.owner:get_luaentity() then
self.object:remove()
end
end
}
minetest.register_entity("witches:witch_tool_wand_btb",witch_tool_wand_btb)
local function item_set_animation(self, anim, force)
@ -299,7 +362,7 @@ function witches.attach_hat(self,item)
end
function witches.attach_tool(self,item)
item = item or "witches:witch_tool"
item = item or "witches:witch_tool_btb"
local tool = minetest.add_entity(self.object:get_pos(), item)
tool:set_attach(self.object, "Arm_Right", {x=0.3, y=4.0, z=2}, {x=-100, y=225, z=90})
tool:get_luaentity().owner = self.object

View File

@ -182,11 +182,18 @@ function witches.magic.splash(self,target,volume,height,node)
local ent_pos = ent.object:get_pos()
local ent_pos_yoff = vector.add(ent_pos,{x=0,y=height,z=0})
local vol = pos_to_vol(ent_pos_yoff,volume)
minetest.sound_play(self.sounds.drench or "witches_water", {
pos = ent_pos,
gain = 1.0,
max_hear_distance = self.sounds and self.sounds.distance or 32
}, true
)
local air_nodes = minetest.find_nodes_in_area(vol[1],vol[2], {"air"})
if air_nodes then
for i=1, #air_nodes do
for i=1, #air_nodes do
minetest.add_node(air_nodes[i], {name=node})
witches.magic.effect_area01(vol[1],vol[2],100)
--print(node.." "..minetest.pos_to_string(air_nodes[i]))

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 737 B

306
witches.lua Normal file
View File

@ -0,0 +1,306 @@
local variance = witches.variance
local rnd_color = witches.rnd_color
local rnd_colors = witches.rnd_colors
local hair_colors = witches.hair_colors
local spawning = {
cottage = {
nodes = {"group:wood","default:mossycobble","default:cobble"},
neighbors = {"air","default:chest","doors:wood_witch_a"},
min_light = 5,
max_light = 15,
interval = 30,
chance = 10,
active_object_count = 2,
min_height = 0,
max_height = 200,
day_toggle = nil,
on_spawn = function(self)
local pos = self.object:get_pos()
print(self.secret_name.." spawned at ".. minetest.pos_to_string(vector.round(pos)))
end,
},
generic = {
nodes = {"group:wood","default:mossycobble","default:cobble"},
neighbors = {"air","default:chest"},
min_light = 5,
max_light = 15,
interval = 300,
chance = 10,
active_object_count = 1,
min_height = 0,
max_height = 200,
day_toggle = nil,
on_spawn = function(self)
local pos = self.object:get_pos()
print(self.secret_name.." spawned at ".. minetest.pos_to_string(vector.round(pos)))
end
}
}
witches.witch_types = {
generic = {
description = "Wanderling",
lore = "This witch wanders about the land, for what do they seek?",
additional_properties = {
special_follow = {"default:diamond", "default:gold_lump", "default:apple",
"default:blueberries", "default:torch", "default:stick",
"flowers:mushroom_brown","flowers:mushroom_red"},
do_custom_addendum = function(self)
if math.random() < .0001 and minetest.registered_nodes["fireflies:firefly"] then
local pos = self.object:get_pos()
pos.y = pos.y+1
local pos1 = minetest.find_node_near(pos, 3, "air")
minetest.set_node(pos1, {name = "fireflies:firefly"})
--print("setting firefly"..minetest.pos_to_string(pos1))
end
end,
on_spawn_addendum = function(self)
--print(dump(self.drops).."and"..dump(minetest.registered_tools))
witches.firefly_mod(self)
end
}
},
cottage = {
description = "Eremitant",
lore = "This witch has found a home for themselves, who would bother them?",
additional_properties = {
special_follow = {"default:diamond", "default:gold_lump", "default:apple",
"default:blueberries", "default:torch", "default:stick",
"flowers:mushroom_brown","flowers:mushroom_red"},
do_custom_addendum = function(self)
end,
on_spawn_addendum = function(self)
witches.claim_witches_chest(self)
end
},
spawning = spawning.cottage,
}
}
witches.witch_template = { --your average witch,
description = "Basic Witch",
lore = "This witch has a story yet to be...",
type = "npc",
passive = false,
attack_type = "dogfight",
attack_monsters = true,
attack_npcs = false,
attack_players = true,
group_attack = true,
runaway = false,
damage = 1,
reach = 2,
knock_back = true,
hp_min = 5,
hp_max = 10,
armor = 100,
visual = "mesh",
mesh = "witches_witch.b3d",
textures = {
"witches_clothes.png"
},
--blood_texture = "witches_blood.png",
collisionbox = {-0.25, 0, -.25, 0.25, 2, 0.25},
drawtype = "front",
makes_footstep_sound = true,
sounds = {
random = "",
war_cry = "",
attack = "",
damage = "",
death = "",
replace = "",
teleport = "witches_magic01",
polymorph = "witches_magic02",
drench = "witches_water",
},
walk_velocity = 2,
run_velocity = 3,
pathfinding = 1,
jump = true,
jump_height = 5,
step_height = 1.5,
fear_height = 4,
water_damage = 0,
lava_damage = 2,
light_damage = 0,
lifetimer = 360,
view_range = 10,
stay_near = "",
order = "follow",
animation = {
stand_speed = 30,
stand_start = 0,
stand_end = 80,
walk_speed = 30,
walk_start = 168,
walk_end = 187,
run_speed = 45,
run_start = 168,
run_end = 187,
punch_speed = 30,
punch_start = 200,
punch_end = 219,
},
drops = {
{name = "default:pick_steel",
chance = 1000, min = 0, max = 1},
{name = "default:shovel_steel",
chance = 1000, min = 0, max = 1},
{name = "default:axe_steel",
chance = 1000, min = 0, max = 1},
{name = "default:axe_stone",
chance = 5, min = 0, max = 1},
},
follow = {
},
additional_properties = {
special_follow = {"default:diamond", "default:gold_lump", "default:apple",
"default:blueberries", "default:torch", "default:stick",
"flowers:mushroom_brown","flowers:mushroom_red"},
},
on_rightclick = function(self,clicker)
witches.quests(self,clicker)
end,
do_custom = function(self)
if self.do_custom_addendum then
self.do_custom_addendum(self)
end
if self.attack then
local s = self.object:get_pos()
local objs = minetest.get_objects_inside_radius(s, 2)
for n = 1, #objs do
local ent = objs[n]:get_luaentity()
if objs[n] == self.attack then
if self.attack:is_player() then
-- witches.magic.banish_underground(self,objs[n],10)
witches.magic.teleport(self,objs[n],math.random(3,8),math.random(2,4))
else
if math.random() < 0.2 then
witches.magic.teleport(self,objs[n],math.random(3,5),math.random(2,4))
witches.magic.polymorph(self,objs[n])
elseif math.random() <.5 then
witches.magic.teleport(self,objs[n],math.random(3,5),math.random(1,2))
witches.magic.splash(self,objs[n],{x=2,y=2,z=2},math.random(0,1))
-- witches.magic.splash(self,target,volume,height,node)
else
witches.magic.teleport(self,objs[n],math.random(3,8),math.random(2,4))
end
-- witches.magic.teleport(self,objs[n],math.random(3,8),math.random(2,4))
end
end
end
end
end,
on_spawn = function(self)
--make sure these are baseline on spawn
--self.animation.walk_speed = 30
--self.animation.run_speed = 45
--self.walk_velocity = 2
--self.run_velocity = 3
--then set modifiers for each individual
if not self.speed_mod then
self.speed_mod = math.random(-1, 1)
end
--print("speed mod: "..self.speed_mod)
--rng for testing variants
if not self.size then
self.size = {x = variance(90,100), y = variance(75,105), z = variance(90,100)}
end
if not self.skin then
self.skin = math.random(1,5)
end
if not self.color_mod then
self.color_mod = rnd_color(rnd_colors)
end
if not self.hair_color then
self.hair_color= rnd_color(hair_colors)
end
local self_properties = self.object:get_properties()
self_properties.visual_size = self.size
self.object:set_properties(self_properties)
--initial speed modifications
self.walk_velocity = self.walk_velocity + ( self.speed_mod / 10 )
self.run_velocity = self.run_velocity + ( self.speed_mod / 10 )
self.animation.walk_speed = self.animation.walk_speed + self.speed_mod
self.animation.run_speed = self.animation.run_speed + self.speed_mod
--no more speed mods!
self.speed_mod = 0
-- so many overlays!
if self.color_mod ~="none" then
self.object:set_texture_mod("^[colorize:"..self.color_mod..":60^witches_skin"..self.skin..".png^witches_accessories.png^witches_witch_hair_"..self.hair_color..".png")
else
self.object:set_texture_mod("^witches_skin"..self.skin..".png^witches_accessories.png^witches_witch_hair_"..self.hair_color..".png")
end
if not self.secret_name then
self.secret_name = witches.generate_text(witches.name_parts_female)
end
if not self.secret_title then
self.secret_title = witches.generate_text(witches.words_desc, {"titles"})
end
if not self.secret_locale then
self.secret_locale = witches.generate_text(witches.name_parts_female, {"syllablesStart","syllablesEnd"})
end
--self.item_request.text = witches.generate_name(witches.quest_dialogs, {"item_request"})
--print(self.secret_name.." has spawned")
--print("self: "..dump(self.follow))
-- print("self properties "..dump(self.object:get_properties()))
--self.follow = {}
if not self.follow or #self.follow < 1 or type(self.follow) == string then
self.follow = {}
table.insert(self.follow,self.special_follow[math.random(#self.special_follow)])
end
if self.on_spawn_addendum then
self.on_spawn_addendum(self)
end
witches.looking_for(self)
end,
spawning = spawning.generic,
after_activate = function(self)
--maddest hatter <|%\D
self.hair_style = math.random(1,#witches.witch_hair_styles)
self.hat_style = math.random(1,#witches.witch_hat_styles)
witches.attach_hair(self,"witches:witch_hair_"..self.hair_style)
witches.attach_hat(self,"witches:witch_hat_"..self.hat_style)
if math.random()<0.5 then
witches.attach_tool(self,"witches:witch_tool_wand_btb")
else
witches.attach_tool(self,"witches:witch_tool_wand_sp")
end
end
}