Preparation for coloured arrows

This commit is contained in:
HybridDog 2015-01-23 22:33:58 +01:00 committed by stujones11
parent ce0931db76
commit dc86ef4ecb
4 changed files with 8 additions and 3 deletions

View file

@ -47,9 +47,14 @@ local function stop_arrow(object, pos, stuck)
object:setacceleration(acceleration) object:setacceleration(acceleration)
end end
-- name is the overlay texture name, colour is used to select the wool texture
local function get_texture(name, colour)
return "shooter_"..name..".png^wool_"..colour..".png^shooter_"..name..".png^[makealpha:255,126,126"
end
minetest.register_craftitem("shooter:arrow", { minetest.register_craftitem("shooter:arrow", {
description = "Arrow", description = "Arrow",
inventory_image = "shooter_arrow_inv.png", inventory_image = get_texture("arrow_inv", "white"),
}) })
minetest.register_entity("shooter:arrow_entity", { minetest.register_entity("shooter:arrow_entity", {
@ -58,7 +63,7 @@ minetest.register_entity("shooter:arrow_entity", {
mesh = "shooter_arrow.b3d", mesh = "shooter_arrow.b3d",
visual_size = {x=1, y=1}, visual_size = {x=1, y=1},
textures = { textures = {
"shooter_arrow_uv.png", get_texture("arrow_uv", "white"),
}, },
timer = 0, timer = 0,
lifetime = SHOOTER_ARROW_LIFETIME, lifetime = SHOOTER_ARROW_LIFETIME,
@ -161,7 +166,7 @@ minetest.register_entity("shooter:arrow_entity", {
minetest.register_tool("shooter:crossbow_loaded", { minetest.register_tool("shooter:crossbow_loaded", {
description = "Crossbow", description = "Crossbow",
inventory_image = "shooter_crossbow_loaded.png", inventory_image = get_texture("crossbow_loaded", "white"),
groups = {not_in_creative_inventory=1}, groups = {not_in_creative_inventory=1},
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
minetest.sound_play("shooter_click", {object=user}) minetest.sound_play("shooter_click", {object=user})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 497 B

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 389 B