From 380468c8034512288cc28f04259579b659269474 Mon Sep 17 00:00:00 2001 From: vulonkaaz <7442677+vulonkaaz@users.noreply.github.com> Date: Fri, 30 Aug 2024 19:09:42 +0200 Subject: first commit --- LICENSE | 7 +++++++ README.md | 13 +++++++++++++ init.lua | 46 ++++++++++++++++++++++++++++++++++++++++++++++ mod.conf | 7 +++++++ textures/blunt.png | Bin 0 -> 17848 bytes 5 files changed, 73 insertions(+) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 init.lua create mode 100644 mod.conf create mode 100644 textures/blunt.png diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e2e41de --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +ISC License + +Copyright 2024 vulonkaaz + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..53a71ef --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# Blunt mod for minetest + +This mod add a smokable blunt to Minetest, craftable with hemp from farming redo and paper + +This mod requires fake_fire for the smoke texture and playereffects for the effect + +## License + +the code is under ISC license + +the texture come from here : https://toppng.com/free-image/blunt-transparent-png-pictures-thug-life-cigarette-PNG-free-PNG-Images_173211 and is licensed "Free for personal use" + +Stoners of the minetest community: I request your assistance to provide high quality assets with a free license, just roll the best blunt you can and send me the photo (you will be credited and the new images will be licensed CC-BY) diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..a437c1b --- /dev/null +++ b/init.lua @@ -0,0 +1,46 @@ +local function smoke_pos(user) + local pos = user:get_pos() + local look = user:get_look_horizontal() + pos.y = pos.y + 1.4 + pos.x = pos.x - math.sin(look)*0.3 + pos.z = pos.z + math.cos(look)*0.3 + return pos +end + +playereffects.register_effect_type("blunt_high", "you feel high", nil, {"gravity"}, + function(player) + player:set_physics_override({gravity=0.2}) + end, + function(effect,player) + player:set_physics_override({gravity=1}) + end +) + +minetest.register_tool("blunt:blunt", { + description = "Blunt", + inventory_image = "blunt.png", + wield_image = "blunt.png^[transformR180", + groups = {tool = 1}, + on_use = function(itemstack, user, pointed_thing) + minetest.add_particle({ + pos = smoke_pos(user), + velocity = {x= 0, y= 0.4, z= 0}, + expirationtime = 4, + size = 5, + texture = "fake_fire_particle_anim_smoke.png", + animation = {type="vertical_frames", aspect_w=16, aspect_h=16, length = 0.9,}, + }) + playereffects.apply_effect_type("blunt_high", 10, user) + itemstack:add_wear_by_uses(21) + return itemstack + end, +}) + +minetest.register_craft({ + output = "blunt:blunt", + recipe = { + {"","default:paper","default:paper"}, + {"default:paper", "farming:hemp_leaf", "farming:hemp_leaf"}, + {"","default:paper","default:paper"} + } +}) diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..91091f8 --- /dev/null +++ b/mod.conf @@ -0,0 +1,7 @@ +name = blunt +description = Adds smokable hemp in Minetest +depends = playereffects, fake_fire +optional_depends = farming +release = 1 +author = vulonkaaz +title = Blunt diff --git a/textures/blunt.png b/textures/blunt.png new file mode 100644 index 0000000..ac6276a Binary files /dev/null and b/textures/blunt.png differ -- cgit v1.2.3