diff --git a/crossbow.lua b/crossbow.lua index 39dc149..5a884d8 100644 --- a/crossbow.lua +++ b/crossbow.lua @@ -47,9 +47,14 @@ local function stop_arrow(object, pos, stuck) object:setacceleration(acceleration) 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", { description = "Arrow", - inventory_image = "shooter_arrow_inv.png", + inventory_image = get_texture("arrow_inv", "white"), }) minetest.register_entity("shooter:arrow_entity", { @@ -58,7 +63,7 @@ minetest.register_entity("shooter:arrow_entity", { mesh = "shooter_arrow.b3d", visual_size = {x=1, y=1}, textures = { - "shooter_arrow_uv.png", + get_texture("arrow_uv", "white"), }, timer = 0, lifetime = SHOOTER_ARROW_LIFETIME, @@ -161,7 +166,7 @@ minetest.register_entity("shooter:arrow_entity", { minetest.register_tool("shooter:crossbow_loaded", { description = "Crossbow", - inventory_image = "shooter_crossbow_loaded.png", + inventory_image = get_texture("crossbow_loaded", "white"), groups = {not_in_creative_inventory=1}, on_use = function(itemstack, user, pointed_thing) minetest.sound_play("shooter_click", {object=user}) diff --git a/textures/shooter_arrow_inv.png b/textures/shooter_arrow_inv.png index 7727c5f..65da440 100644 Binary files a/textures/shooter_arrow_inv.png and b/textures/shooter_arrow_inv.png differ diff --git a/textures/shooter_arrow_uv.png b/textures/shooter_arrow_uv.png index 57017c8..0225e43 100644 Binary files a/textures/shooter_arrow_uv.png and b/textures/shooter_arrow_uv.png differ diff --git a/textures/shooter_crossbow_loaded.png b/textures/shooter_crossbow_loaded.png index bd46531..77dc04a 100644 Binary files a/textures/shooter_crossbow_loaded.png and b/textures/shooter_crossbow_loaded.png differ