Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Commit

Permalink
hemp brick
Browse files Browse the repository at this point in the history
  • Loading branch information
pithydon committed Dec 18, 2016
1 parent bd0008b commit b6971d6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 42 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hemp v1.0 by pithydon (2016)
hemp v1.0_git

Rope function stolen from [foot_on_teh_hill].

Expand All @@ -9,10 +9,6 @@ Hemp plants are full grown at stage 8 or when they are 2 nodes tall.
Seeds can be cooked for food or replanted.
Leaves can be crafted into Hemp fiber, useful for ropes, rope fences, fabric, hemp fabric rugs, hempcrete, and paper.

Forum: https://forum.minetest.net/viewtopic.php?t=14588

Github: https://github.com/pithydon/hemp

License for all of this mod is "CC0", see below.

```txt
Expand Down
59 changes: 22 additions & 37 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
-- craft recipes
-- mapgen
-- TRM
-- legacy code
-- }

-- rope function
Expand Down Expand Up @@ -386,22 +385,23 @@ minetest.register_node("hemp:hemp_rug", {
wall_top = {-0.5, 0.4375, -0.5, 0.5, 0.5, 0.5},
wall_bottom = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5},
wall_side = {-0.5, -0.5, -0.5, -0.4375, 0.5, 0.5}
},
-- on_place is used for compatibility with older version.
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" or pointed_thing.under.y > pointed_thing.above.y then
return itemstack
else
return minetest.item_place(itemstack, placer, pointed_thing, param2)
end
end
}
})

minetest.register_node("hemp:hempcrete", {
description = "Hempcrete",
tiles = {"hemp_hempcrete.png"},
groups = {crumbly = 1, cracky = 3},
drawtype = "normal"
drawtype = "normal",
sound = default.node_sound_stone_defaults()
})

minetest.register_node("hemp:hempcrete_brick", {
description = "Hempcrete Brick",
tiles = {"hemp_hempcrete_brick.png"},
groups = {crumbly = 1, cracky = 3},
drawtype = "normal",
sound = default.node_sound_stone_defaults()
})

if minetest.get_modpath("flowerpots") then
Expand Down Expand Up @@ -430,25 +430,13 @@ if minetest.get_modpath("flowerpots") then
{-0.25, -0.3125, -0.25, 0.25, 0.5, 0.25}
}
},
groups = {dig_immediate = 2, not_in_creative_inventory = 1},
groups = {snappy = 3, cracky = 3, oddly_breakable_by_hand = 3, not_in_creative_inventory = 1},
on_punch = flowerpots.take_plant("hemp:seed_hemp")
})

flowerpots.plants["hemp:seed_hemp"] = "hemp:flowerpot_hemp"

local flowerpot_def = minetest.registered_nodes["flowerpots:pot"]
local hempseed_def = table.copy(minetest.registered_items["hemp:seed_hemp"])
minetest.override_item("hemp:seed_hemp", {
on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.under
local node = minetest.get_node(pos)
if node.name == "flowerpots:pot" then
flowerpot_def.on_rightclick(pos, node, placer, itemstack, pointed_thing)
else
hempseed_def.on_place(itemstack, placer, pointed_thing)
end
end
})
flowerpots.override_on_place("hemp:seed_hemp")
end

-- craft items
Expand Down Expand Up @@ -555,6 +543,14 @@ minetest.register_craft({
}
})

minetest.register_craft({
output = "hemp:hempcrete_brick 4",
recipe = {
{"hemp:hempcrete", "hemp:hempcrete"},
{"hemp:hempcrete", "hemp:hempcrete"}
}
})

-- mapgen
if minetest.setting_getbool("enable_hemp_mapgen") ~= false then
local mg_params = minetest.get_mapgen_params()
Expand Down Expand Up @@ -587,19 +583,8 @@ if minetest.get_modpath("treasurer") then
treasurer.register_treasure("hemp:hemp_rope_fence",0.02,3,{1,7},nil,"building_block")
treasurer.register_treasure("hemp:hemp_rug",0.01,3,{1,6},nil,"deco")
treasurer.register_treasure("hemp:hempcrete",0.01,4,{1,4},nil,"building_block")
treasurer.register_treasure("hemp:hempcrete_brick",0.01,4,{1,4},nil,"building_block")
treasurer.register_treasure("hemp:cooked_seed_hemp",0.006,2,{1,3},nil,"food")
treasurer.register_treasure("hemp:hemp_fiber",0.05,2,{1,16},nil,"crafting_component")
treasurer.register_treasure("hemp:hemp_fabric",0.05,2,{1,4},nil,"crafting_component")
end

-- legacy code
minetest.register_lbm({
name = "hemp:convert_hemp_rug_to_wallmounted",
nodenames = {"hemp:hemp_rug"},
run_at_every_load = true,
action = function(pos, node)
if node.param2 == 0 then
minetest.swap_node(pos, {name = node.name, param2 = 1})
end
end
})
Binary file added textures/hemp_hempcrete_brick.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b6971d6

Please sign in to comment.