Cleanup, updates and image compression

master
Juraj Vajda 2021-03-21 12:13:10 -04:00
parent 2bb9c7e4ce
commit 5a9bb9d5ba
122 changed files with 407 additions and 128 deletions

View File

@ -6,7 +6,7 @@ Extends Minetest default farming mod with new plants and crops using only minete
## Description
Hunger points in the description assume that you have [hudbars](https://bitbucket.org/minetest_gamers/hudbars) with hunger mod configured with x_farming. If not then you can consider hunger points as health points.
Hunger points in the description assume that you have [hbhubger](https://forum.minetest.net/viewtopic.php?t=11336) with hunger mod configured with x_farming. If not then you can consider hunger points as health points.
### Empty Soup Bowl ![screenshot](textures/x_farming_bowl.png)
@ -199,8 +199,13 @@ Getting seeds from decorations (grass..) can be changed/adjusted in the future w
- default
- farming
## Optional Dependencies
- hbhunger
- flowers
- vessels
- mobs_animal
## License:

178
api.lua
View File

@ -1,120 +1,126 @@
-- main class
x_farming = {}
x_farming = {
hbhunger = minetest.get_modpath("hbhunger"),
colors = {
brown = "#DEB887",
red = "#FF8080",
green = "#98E698"
}
}
MINLIGHT = 13
MAXLIGHT = default.LIGHT_MAX
-- how often node timers for plants will tick, +/- some random value
function x_farming.tick(pos)
minetest.get_node_timer(pos):start(math.random(498, 1287))
minetest.get_node_timer(pos):start(math.random(498, 1287))
end
-- how often a growth failure tick is retried (e.g. too dark)
function x_farming.tick_short(pos)
minetest.get_node_timer(pos):start(math.random(332, 858))
-- minetest.get_node_timer(pos):start(math.random(166, 286))
minetest.get_node_timer(pos):start(math.random(332, 858))
end
-- just shorthand for minetest metadata handling
function x_farming.meta_get_str(key, pos)
local meta = minetest.get_meta(pos)
return meta:get_string(key)
local meta = minetest.get_meta(pos)
return meta:get_string(key)
end
-- just shorthand for minetest metadata handling
function x_farming.meta_set_str(key, value, pos)
local meta = minetest.get_meta(pos)
meta:set_string(key, value)
local meta = minetest.get_meta(pos)
meta:set_string(key, value)
end
-- grow blocks next to the plant
function x_farming.grow_block(pos, elapsed)
local node = minetest.get_node(pos)
local random_pos = false
local spawn_positions = {}
local right_pos = {x=pos.x+1, y=pos.y, z=pos.z}
local front_pos = {x=pos.x, y=pos.y, z=pos.z+1}
local left_pos = {x=pos.x-1, y=pos.y, z=pos.z}
local back_pos = {x=pos.x, y=pos.y, z=pos.z-1}
local right = minetest.get_node(right_pos)
local front = minetest.get_node(front_pos)
local left = minetest.get_node(left_pos)
local back = minetest.get_node(back_pos)
local def = minetest.registered_nodes[node.name]
local node = minetest.get_node(pos)
local random_pos = false
local spawn_positions = {}
local right_pos = {x=pos.x+1, y=pos.y, z=pos.z}
local front_pos = {x=pos.x, y=pos.y, z=pos.z+1}
local left_pos = {x=pos.x-1, y=pos.y, z=pos.z}
local back_pos = {x=pos.x, y=pos.y, z=pos.z-1}
local right = minetest.get_node(right_pos)
local front = minetest.get_node(front_pos)
local left = minetest.get_node(left_pos)
local back = minetest.get_node(back_pos)
local def = minetest.registered_nodes[node.name]
local children = {}
local children = {}
-- look for fruits around the stem
if (right.name == def.next_plant) then
children.right = right_pos
end
if (front.name == def.next_plant) then
children.front = front_pos
end
if (left.name == def.next_plant) then
children.left = left_pos
end
if (back.name == def.next_plant) then
children.back = back_pos
end
-- look for fruits around the stem
if (right.name == def.next_plant) then
children.right = right_pos
end
if (front.name == def.next_plant) then
children.front = front_pos
end
if (left.name == def.next_plant) then
children.left = left_pos
end
if (back.name == def.next_plant) then
children.back = back_pos
end
-- check if the fruit belongs to this stem
for side,child_pos in pairs(children) do
-- print(side, minetest.pos_to_string(child_pos))
-- check if the fruit belongs to this stem
for side,child_pos in pairs(children) do
-- print(side, minetest.pos_to_string(child_pos))
local parent_pos_from_child = x_farming.meta_get_str("parent", child_pos)
local parent_pos_from_child = x_farming.meta_get_str("parent", child_pos)
-- disable timer for fully grown plant - fruit for this stem already exists
if minetest.pos_to_string(pos) == parent_pos_from_child then
return
end
end
-- disable timer for fully grown plant - fruit for this stem already exists
if minetest.pos_to_string(pos) == parent_pos_from_child then
return
end
end
-- make sure that at least one side of the plant has space to put fruit
if right.name == "air" then
table.insert(spawn_positions, right_pos)
end
if front.name == "air" then
table.insert(spawn_positions, front_pos)
end
if left.name == "air" then
table.insert(spawn_positions, left_pos)
end
if back.name == "air" then
table.insert(spawn_positions, back_pos)
end
-- make sure that at least one side of the plant has space to put fruit
if right.name == "air" then
table.insert(spawn_positions, right_pos)
end
if front.name == "air" then
table.insert(spawn_positions, front_pos)
end
if left.name == "air" then
table.insert(spawn_positions, left_pos)
end
if back.name == "air" then
table.insert(spawn_positions, back_pos)
end
-- plant is closed from all sides
if #spawn_positions < 1 then
x_farming.tick_short(pos)
return
else
-- pick random from the open sides
local pick_random
-- plant is closed from all sides
if #spawn_positions < 1 then
x_farming.tick_short(pos)
return
else
-- pick random from the open sides
local pick_random
if #spawn_positions == 1 then
pick_random = #spawn_positions
else
pick_random = math.random(1, #spawn_positions)
end
if #spawn_positions == 1 then
pick_random = #spawn_positions
else
pick_random = math.random(1, #spawn_positions)
end
for k, v in pairs (spawn_positions) do
if k == pick_random then
random_pos = v
end
end
end
for k, v in pairs (spawn_positions) do
if k == pick_random then
random_pos = v
end
end
end
-- check light
local light = minetest.get_node_light(pos)
if not light or light < MINLIGHT or light > MAXLIGHT then
x_farming.tick_short(pos)
return
end
-- check light
local light = minetest.get_node_light(pos)
if not light or light < MINLIGHT or light > MAXLIGHT then
x_farming.tick_short(pos)
return
end
-- spawn block
if random_pos then
minetest.set_node(random_pos, {name = def.next_plant})
x_farming.meta_set_str("parent", minetest.pos_to_string(pos), random_pos)
end
return
-- spawn block
if random_pos then
minetest.set_node(random_pos, {name = def.next_plant})
x_farming.meta_set_str("parent", minetest.pos_to_string(pos), random_pos)
end
return
end

View File

@ -17,5 +17,6 @@ farming.register_plant("x_farming:beetroot", {
-- needed
minetest.override_item("x_farming:beetroot", {
description = "Beetroot" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 3"),
on_use = minetest.item_eat(3),
})

View File

@ -17,5 +17,6 @@ farming.register_plant("x_farming:carrot", {
-- needed
minetest.override_item("x_farming:carrot", {
description = "Carrot" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 3"),
on_use = minetest.item_eat(3),
})

View File

@ -117,7 +117,7 @@ end
-- COCOA
minetest.register_craftitem("x_farming:cocoa_bean", {
description = "Cocoa bean",
description = "Cocoa bean (plant on jungle tree)",
tiles = {"x_farming_cocoa_bean.png"},
inventory_image = "x_farming_cocoa_bean.png",
wield_image = "x_farming_cocoa_bean.png",

View File

@ -13,7 +13,7 @@ farming.register_plant("x_farming:coffee", {
-- cold cup of coffee
minetest.register_node("x_farming:coffee_cup", {
description = "Cold Cup of Coffee",
description = "Cold Cup of Coffee" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 4"),
drawtype = "plantlike",
tiles = {"x_farming_coffee_cup.png"},
inventory_image = "x_farming_coffee_cup.png",
@ -30,8 +30,14 @@ minetest.register_node("x_farming:coffee_cup", {
})
-- hot cup of coffee
local coffee_cup_hot_desc = "Hot Cup of Coffee" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 6")
if x_farming.hbhunger ~= nil then
coffee_cup_hot_desc = coffee_cup_hot_desc .. "\n" .. minetest.colorize(x_farming.colors.red, "Heal: 4")
end
minetest.register_node("x_farming:coffee_cup_hot", {
description = "Hot Cup of Coffee",
description = coffee_cup_hot_desc,
drawtype = "plantlike",
tiles = {"x_farming_coffee_cup_hot.png"},
inventory_image = "x_farming_coffee_cup_hot.png",

View File

@ -53,7 +53,7 @@ minetest.override_item("x_farming:corn_10", {
-- popcorn
minetest.register_node("x_farming:corn_popcorn", {
description = "Popcorn",
description = "Popcorn" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 5"),
drawtype = "plantlike",
tiles = {"x_farming_corn_popcorn.png"},
inventory_image = "x_farming_corn_popcorn.png",

View File

@ -11,7 +11,7 @@ minetest.register_craft( {
})
minetest.register_craftitem("x_farming:cookie", {
description = "Cookie",
description = "Cookie" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 2"),
inventory_image = "x_farming_cookie.png",
on_use = minetest.item_eat(2),
})
@ -24,7 +24,7 @@ minetest.register_craft( {
})
minetest.register_craftitem("x_farming:chocolate", {
description = "Chocolate",
description = "Chocolate" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 3"),
inventory_image = "x_farming_chocolate.png",
on_use = minetest.item_eat(3),
})
@ -54,7 +54,7 @@ minetest.register_craft({
-- Hog Stew
minetest.register_craftitem("x_farming:hog_stew", {
description = "Hog Stew",
description = "Hog Stew" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 8"),
inventory_image = "x_farming_hog_stew.png",
on_use = minetest.item_eat(8, "x_farming:bowl"),
})
@ -79,7 +79,7 @@ minetest.register_craft({
-- Beetroot
minetest.register_craftitem("x_farming:beetroot_soup", {
description = "Beetroot Soup",
description = "Beetroot Soup" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 6"),
inventory_image = "x_farming_beetroot_soup.png",
on_use = minetest.item_eat(6, "x_farming:bowl"),
})
@ -94,8 +94,14 @@ minetest.register_craft({
})
-- Carrot
local golden_carrot_desc = "Golden Carrot" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 10")
if x_farming.hbhunger ~= nil then
golden_carrot_desc = golden_carrot_desc .. "\n" .. minetest.colorize(x_farming.colors.red, "Heal: 10")
end
minetest.register_craftitem("x_farming:carrot_golden", {
description = "Golden Carrot",
description = golden_carrot_desc,
inventory_image = "x_farming_carrot_golden.png",
wield_image = "x_farming_carrot_golden.png^[transformR270",
on_use = minetest.item_eat(10),
@ -128,7 +134,7 @@ minetest.register_craft({
-- Corn
minetest.register_craftitem("x_farming:corn_pop", {
description = "Popped corn",
description = "Popped corn" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 1"),
inventory_image = "x_farming_corn_pop.png",
on_use = minetest.item_eat(1),
})
@ -150,8 +156,14 @@ minetest.register_craft( {
})
-- Melon
local golden_melon_desc = "Golden Melon" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 10")
if x_farming.hbhunger ~= nil then
golden_melon_desc = golden_melon_desc .. "\n" .. minetest.colorize(x_farming.colors.red, "Heal: 10")
end
minetest.register_craftitem("x_farming:golden_melon", {
description = "Golden Melon - Restores Hearts",
description = golden_melon_desc,
inventory_image = "x_farming_golden_melon.png",
wield_image = "x_farming_golden_melon.png^[transformR90",
on_use = minetest.item_eat(10),
@ -223,15 +235,21 @@ minetest.register_craft({
-- Potato
minetest.register_craftitem("x_farming:bakedpotato", {
description = "Baked Potato",
description = "Baked Potato" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 6"),
inventory_image = "x_farming_potato_baked.png",
on_use = minetest.item_eat(6),
})
local poisonouspotato_desc = "Poisonous Potato" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: -6")
if x_farming.hbhunger ~= nil then
poisonouspotato_desc = poisonouspotato_desc .. "\n" .. minetest.colorize(x_farming.colors.green, "Poison: 5")
end
minetest.register_craftitem("x_farming:poisonouspotato", {
description = "Poisonous Potato",
description = poisonouspotato_desc,
inventory_image = "x_farming_potato_poisonous.png",
on_use = minetest.item_eat(-5),
on_use = minetest.item_eat(-6),
})
minetest.register_craft({
@ -254,7 +272,7 @@ minetest.register_craft({
-- crafted item from recipe
minetest.register_craftitem("x_farming:pumpkin_pie", {
description = "Pumpkin Pie",
description = "Pumpkin Pie" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 6"),
inventory_image = "x_farming_pumpkin_pie.png",
on_use = minetest.item_eat(6),
})

View File

@ -1,6 +1,7 @@
-- Farming Addons
-- by SaKeL
local mod_start_time = minetest.get_us_time()
local path = minetest.get_modpath("x_farming")
dofile(path.."/api.lua")
@ -15,5 +16,17 @@ dofile(path.."/carrot.lua")
dofile(path.."/cocoa.lua")
dofile(path.."/seeds.lua")
dofile(path.."/crafting.lua")
-- hbhunger
if x_farming.hbhunger ~= nil then
if hbhunger.register_food ~= nil then
dofile(path.."/register_hbhunger.lua")
end
end
print ("[Mod] Farming Addons Loaded.")
if minetest.get_modpath("mobs_npc") then
dofile(path.."/snow_golem.lua")
end
local mod_end_time = (minetest.get_us_time() - mod_start_time) / 1000000
print ("[Mod] x_farming loaded.. [".. mod_end_time .."s]")

View File

@ -12,6 +12,7 @@ farming.register_plant("x_farming:melon", {
-- needed
minetest.override_item("x_farming:melon", {
description = "Melon" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 2"),
on_use = minetest.item_eat(2),
wield_image = "x_farming_melon.png^[transformR90",
})
@ -22,7 +23,7 @@ minetest.register_node("x_farming:melon_fruit", {
tiles = {"x_farming_melon_fruit_top.png", "x_farming_melon_fruit_top.png", "x_farming_melon_fruit_side.png", "x_farming_melon_fruit_side.png", "x_farming_melon_fruit_side.png", "x_farming_melon_fruit_side.png"},
sounds = default.node_sound_wood_defaults(),
is_ground_content = false,
groups = {snappy=3, flammable=4, fall_damage_add_percent=-30},
groups = {snappy=3, flammable=4, fall_damage_add_percent=-30, not_in_creative_inventory=1},
drop = {
max_items = 7, -- Maximum number of items to drop.
items = { -- Choose max_items randomly from this list.

View File

@ -1,4 +1,4 @@
name = x_farming
description = Extends Minetest farming with new plants and crops.
optional_depends = hbhunger, flowers, vessels
depends = default, farming
description = Extends Minetest farming mod with new plants and crops.
depends = default, farming
optional_depends = hbhunger, flowers, vessels, mobs_animal, mobs_npc

Binary file not shown.

View File

@ -3,7 +3,7 @@ local maxlight = default.LIGHT_MAX
-- OBSIDIAN WART
farming.register_plant("x_farming:obsidian_wart", {
description = "Obsidian Wart Seed",
description = "Obsidian Wart Seed" .. "\n" .. "Plant on Obsidian",
paramtype2 = "meshoptions",
inventory_image = "x_farming_obsidian_wart_seed.png",
steps = 6,

View File

@ -17,6 +17,7 @@ farming.register_plant("x_farming:potato", {
-- needed
minetest.override_item("x_farming:potato", {
description = "Potato" .. "\n" .. minetest.colorize(x_farming.colors.brown, "Hunger: 2"),
on_use = minetest.item_eat(2),
})
@ -32,7 +33,3 @@ minetest.override_item("x_farming:potato_8", {
}
}
})
if minetest.get_modpath("hbhunger") ~= nil then
hbhunger.register_food("x_farming:poisonouspotato", 1, "", 5)
end

View File

@ -1,20 +1,20 @@
-- spawn snow golem
-- local function pumpkin_on_construct(pos)
-- if not minetest.get_modpath("mobs_npc") then return end
local function pumpkin_on_construct(pos)
if not minetest.get_modpath("mobs_npc") then return end
-- for i = 1,2 do
-- if minetest.get_node({x=pos.x,y=pos.y-i,z=pos.z}).name ~= "default:snowblock" then
-- return
-- end
-- end
for i = 1,2 do
if minetest.get_node({x=pos.x,y=pos.y-i,z=pos.z}).name ~= "default:snowblock" then
return
end
end
-- --if 3 snow block are placed, this will make snow golem
-- for i = 0,2 do
-- minetest.remove_node({x=pos.x,y=pos.y-i,z=pos.z})
-- end
--if 3 snow block are placed, this will make snow golem
for i = 0,2 do
minetest.remove_node({x=pos.x,y=pos.y-i,z=pos.z})
end
-- minetest.add_entity({x=pos.x,y=pos.y-1,z=pos.z}, "mobs_npc:snow_golem")
-- end
minetest.add_entity({x=pos.x,y=pos.y-1,z=pos.z}, "mobs_npc:snow_golem")
end
-- PUMPKIN
farming.register_plant("x_farming:pumpkin", {
@ -35,7 +35,7 @@ minetest.register_node("x_farming:pumpkin_fruit", {
paramtype2 = "facedir",
sounds = default.node_sound_wood_defaults(),
is_ground_content = false,
groups = {snappy=3, flammable=4, fall_damage_add_percent=-30},
groups = {snappy=3, flammable=4, fall_damage_add_percent=-30, not_in_creative_inventory=1},
drop = {
max_items = 4, -- Maximum number of items to drop.
items = { -- Choose max_items randomly from this list.
@ -79,7 +79,7 @@ minetest.register_node("x_farming:pumpkin_block", {
sounds = default.node_sound_wood_defaults(),
is_ground_content = false,
groups = {snappy=3, flammable=4, fall_damage_add_percent=-30},
-- on_construct = pumpkin_on_construct
on_construct = pumpkin_on_construct
})
-- PUMPKIN LANTERN -- from recipe
@ -93,7 +93,7 @@ minetest.register_node("x_farming:pumpkin_lantern", {
light_source = 12,
drop = "x_farming:pumpkin_lantern",
groups = {snappy=3, flammable=4, fall_damage_add_percent=-30},
-- on_construct = pumpkin_on_construct
on_construct = pumpkin_on_construct
})
-- drop blocks instead of items

36
register_hbhunger.lua Normal file
View File

@ -0,0 +1,36 @@
-- name, hunger_change, replace_with_item, poisen, heal, sound
-- beetroot
hbhunger.register_food("x_farming:beetroot", 3)
hbhunger.register_food("x_farming:beetroot_soup", 6, "x_farming:bowl")
-- carrot
hbhunger.register_food("x_farming:carrot", 3)
hbhunger.register_food("x_farming:carrot_golden", 10, nil, nil, 10)
-- coffee
hbhunger.register_food("x_farming:coffee_cup", 4, "vessels:drinking_glass")
hbhunger.register_food("x_farming:coffee_cup_hot", 6, "vessels:drinking_glass", nil, 4)
-- corn
hbhunger.register_food("x_farming:corn_pop", 1)
hbhunger.register_food("x_farming:corn_popcorn", 5)
-- melon
hbhunger.register_food("x_farming:melon", 2)
hbhunger.register_food("x_farming:golden_melon", 10, "", nil, 10)
-- potato
hbhunger.register_food("x_farming:potato", 2)
hbhunger.register_food("x_farming:bakedpotato", 6)
hbhunger.register_food("x_farming:poisonouspotato", -6, nil, 5)
-- pumpkin
hbhunger.register_food("x_farming:pumpkin_pie", 6)
-- hog stew
hbhunger.register_food("x_farming:hog_stew", 8, "x_farming:bowl")
-- cocoa
hbhunger.register_food("x_farming:cookie", 2)
hbhunger.register_food("x_farming:chocolate", 3)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 665 KiB

After

Width:  |  Height:  |  Size: 403 KiB

195
snow_golem.lua Normal file
View File

@ -0,0 +1,195 @@
local S = mobs.intllib
mobs.npc_drops = {
"default:mese_crystal",
"default:pick_steel",
"default:pick_bronze",
"default:sword_steel",
"default:sword_bronze",
"default:shovel_steel",
"default:shovel_bronze",
"default:axe_steel",
"default:axe_bronze",
"farming:bread",
"farming:hoe_steel",
"bucket:bucket_water",
"mobs:meat",
"mobs:beehive",
"mobs:egg",
"mobs:chicken_cooked",
"mobs:bucket_milk",
"mobs:cheese",
"mobs:pork_cooked",
"mobs_npc:pumpkin_block",
"mobs_npc:melon_fruit",
"screwdriver:screwdriver",
"default:diamond",
"default:gold_lump",
"default:coalblock"
}
local snow_golem_def = {
type = "npc",
passive = false,
pathfinding = true,
docile_by_day = true,
attack_type = "dogshoot",
attacks_monsters = true,
damage = 5,
group_attack = true,
owner_loyal = true,
shoot_interval = 0.9,
dogshoot_switch = 1,
dogshoot_count_max = 10,
arrow = "mobs_npc:snowball_arrow",
shoot_offset = 1,
reach = 2,
damage = 3,
hp_min = 35,
hp_max = 70,
armor = 100,
collisionbox = {-0.35, -0.1, -0.35, 0.35, 1.89, 0.35},
visual_size = {x = 2.9, y = 2.9},
visual = "mesh",
mesh = "x_farming_snowman.b3d",
drawtype = "front",
textures = {
{"x_farming_snowman.png^x_farming_snowman_pumpkin.png"},
},
blood_texture = "default_snowball.png",
owner = "",
order = "follow",
makes_footstep_sound = true,
walk_velocity = 0.6,
run_velocity = 2,
view_range = 15,
jump = true,
floats = 1,
drops = {
{name = "default:snow", chance = 1, min = 0, max = 15},
{name = "mobs_npc:seed_pumpkin", chance = 5, min = 1, max = 3}
},
follow = {"farming:bread", "mobs:meat", "default:diamond"},
water_damage = 6,
lava_damage = 10,
light_damage = 0,
fear_height = 4,
animation = {
speed_normal = 25,
speed_run = 50,
stand_start = 20,
stand_end = 40,
walk_start = 0,
walk_end = 20,
run_start = 0,
run_end = 20,
die_start = 40,
die_end = 50,
die_loop = false,
},
on_rightclick = function(self, clicker)
-- feed to heal npc
if mobs:feed_tame(self, clicker, 8, true, true) then return end
-- capture npc with net or lasso
if mobs:capture_mob(self, clicker, 0, 5, 80, false, nil) then return end
-- protect npc with mobs:protector
if mobs:protect(self, clicker) then return end
local item = clicker:get_wielded_item()
local name = clicker:get_player_name()
-- right clicking with gold lump drops random item from mobs.npc_drops
if item:get_name() == "default:gold_lump" then
if not mobs.is_creative(name) then
item:take_item()
clicker:set_wielded_item(item)
end
local pos = self.object:get_pos()
pos.y = pos.y + 0.5
-- add item if it exists
local obj = minetest.add_item(pos, {
name = mobs.npc_drops[math.random(1, #mobs.npc_drops)]
})
if obj and obj:get_luaentity() then
obj:setvelocity({
x = math.random(-10, 10) / 9,
y = 6,
z = math.random(-10, 10) / 9,
})
elseif obj then
obj:remove() -- item does not exist
end
minetest.chat_send_player(name, S("Snow Golem dropped you an item for gold!"))
return
end
-- by right-clicking owner can switch npc between follow and stand
if self.owner and self.owner == name then
if self.order == "follow" then
self.order = "stand"
minetest.chat_send_player(name, S("NPC stands still."))
else
self.order = "follow"
minetest.chat_send_player(name, S("NPC will follow you."))
end
end
end,
}
mobs:register_mob(":mobs_npc:snow_golem", snow_golem_def)
-- mobs:spawn({
-- name = "mobs_npc:snow_golem",
-- nodes = {"default:desert_sand", "default:desert_stone", "default:sand", "default:sandstone", "default:silver_sand", "mobs_npc:deco_stone_eye", "mobs_npc:deco_stone_men", "mobs_npc:deco_stone_sun"},
-- min_light = 0,
-- max_light = 20,
-- chance = 2000,
-- active_object_count = 2,
-- day_toggle = false,
-- })
mobs:register_egg(":mobs_npc:snow_golem", "Snow Golem", "default_snow.png", 1)
-- shooting
mobs:register_arrow(":mobs_npc:snowball_arrow", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"default_snowball.png"},
velocity = 14,
tail = 0,
tail_texture = "default_snowball.png",
glow = 5,
-- tail_size = 10,
-- direct hit, no fire... just plenty of pain
hit_player = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 8},
}, nil)
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 8},
}, nil)
end,
hit_node = function(self, pos, node)
end
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 B

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 B

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 B

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 B

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 B

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 B

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 B

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 B

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 B

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 B

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 B

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 B

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 B

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 B

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 B

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 446 B

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 598 B

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 615 B

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 247 B

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 244 B

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 B

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 B

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 B

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 250 B

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 B

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 B

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

After

Width:  |  Height:  |  Size: 207 B

Some files were not shown because too many files have changed in this diff Show More