[mod] Zero-Effort Custom Minerals [instant_ores]

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

[mod] Zero-Effort Custom Minerals [instant_ores]

by Piezo_ » Post

I'm lazy.

I don't like writing out lots of code, especially the amount required to create a new ore, and I really don't like doing all of the math that's also required to balance the speed, strength, etc. of a new material.

Calinou may have made moreores to partially simplify things for those of us who are mildly lazy, but I'm not mildly lazy, I'm extremely lazy.

I am the absolute embodiment of sloth! I want making an entire mineral to be as easy as if I were registering a simple node!
So, for those of you who are as lazy as me, I present instant_ores.
Image

Now, you can have all the ores you desire, with as few lines of code as possible, using the power of dark magic (hacky, questionably sane code and terrible math).
It's as easy as instant_ores.register_metal(definition table) (or instant_ores.register_crystal, if you prefer).

So, next time you're making a mod with ores in it, why do things the hard way? Don't resist the temptation. It's not 'cheating'. If they judge you, they're just jealous. Come on, download it. You know you want to......give me your soul!

Technical details
License: GPLV3+ for code, various Creative Commons licenses for textures.
Depends: default
Optional: farming
while (true) { suffer(); }

User avatar
BuckarooBanzay
Member
Posts: 435
Joined: Tue Apr 24, 2018 05:58
GitHub: BuckarooBanzay
IRC: BuckarooBanzai
In-game: BuckarooBanzai

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by BuckarooBanzay » Post

I really like your mod descriptions :)

For the next stage of lazyness: how about default values?
¯\_(ツ)_/¯ Not active here anymore, contact me on the minetest discord, irc, lemmy or github (for programming issues)

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by Piezo_ » Post

BuckarooBanzay wrote:I really like your mod descriptions :)

For the next stage of lazyness: how about default values?
Oh, we've got those. The absolute minimum you have to specify is a name and a color (and a description, unless you don't mind your material being called "Terribly Programmed Ingot").
while (true) { suffer(); }

User avatar
Pyrollo
Developer
Posts: 385
Joined: Mon Jan 08, 2018 15:14
GitHub: pyrollo
In-game: Naj
Location: Paris

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by Pyrollo » Post

BuckarooBanzay wrote:I really like your mod descriptions :)

For the next stage of lazyness: how about default values?
I propose a improvement: a mod that chooses new ores ramdomly so you don't even have make effort for that.
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]

User avatar
davidthecreator
Member
Posts: 452
Joined: Mon Aug 18, 2014 19:48
GitHub: daviddoesminetest
In-game: DavidDoesMinetest
Location: Lithuania

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by davidthecreator » Post

> too lazy to register something as simple as ores with some basic uses for them the classical way

> Makes an advanced ore registration system, that was probably extremelly hard to make


+11

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by Piezo_ » Post

Pyrollo wrote:I propose a improvement: a mod that chooses new ores ramdomly so you don't even have make effort for that.
Ok, now you've got me really thinking:

A couple of ores created based on the map seed, using perlin noise.

Each world would truly be unique, then!

I could probably do it, but in a different mod that depended on this one.

I'm tempted. Should I?
while (true) { suffer(); }

User avatar
v-rob
Developer
Posts: 970
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
IRC: v-rob
Location: Right behind you.

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by v-rob » Post

Piezo_ wrote:I'm tempted. Should I?
It all depends. How lazy do you feel?
Core Developer | My Best Mods: Bridger - Slats - Stained Glass

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by Piezo_ » Post

v-rob wrote:
Piezo_ wrote:I'm tempted. Should I?
It all depends. How lazy do you feel?
Actually, the biggest issue would be if minetest.get_perlin doesn't work properly during the initialization phase.
I'll have to try to find out.
while (true) { suffer(); }

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by texmex » Post

Piezo_ wrote:A couple of ores created based on the map seed, using perlin noise.
Yes please!

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by Piezo_ » Post

texmex wrote:
Piezo_ wrote:A couple of ores created based on the map seed, using perlin noise.
Yes please!
Alright, I guess I have no excuse to just sit around and not do this any more.

*Piezo_ opens mousepad
while (true) { suffer(); }

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by Piezo_ » Post

So, I've almost finished unique_ores, that adds 2 ores which are unique to every map.

Is 2 enough?
while (true) { suffer(); }

User avatar
Pyrollo
Developer
Posts: 385
Joined: Mon Jan 08, 2018 15:14
GitHub: pyrollo
In-game: Naj
Location: Paris

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by Pyrollo » Post

Piezo_ wrote:Is 2 enough?
I think you have been too lazy :p
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by Piezo_ » Post

Pyrollo wrote:
Piezo_ wrote:Is 2 enough?
I think you have been too lazy :p
Too late, it's already here.
while (true) { suffer(); }

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by Piezo_ » Post

Update

I just learned about the level group, and have put it to use allowing for minerals to properly have hardness above 3
while (true) { suffer(); }

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by Piezo_ » Post

Update
  • Added 3d_armor and shields support
  • Changed tool groups to the new standard (see topic: viewtopic.php?f=5&t=22075)
  • Added options to disable armor or tools in mineral definitions
while (true) { suffer(); }

User avatar
Inky_Bendy
Member
Posts: 19
Joined: Wed Jan 15, 2020 21:22
In-game: Inky_Bendy

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by Inky_Bendy » Post

Help, I'm terrible at coding, and EVEN MORE LAZY. How do I add new ores.

ThorfinnS
Member
Posts: 311
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by ThorfinnS » Post

The easiest, laziest way is to also use Piezo_'s unique_ores. I guess the second easiest would be to glance at the coding in unique_ores and strip out the random part, just specify the colors and characteristics you want.

https://notabug.org/Piezo_/unique_ores.git

barbas72n
New member
Posts: 2
Joined: Fri Jan 18, 2019 20:27

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by barbas72n » Post

I have made myownium, for my server:

Code: Select all

instant_ores.register_metal({
	name = "gnu_slash_ores:myownium",
	description = "Myownium",
	rarity = 14,
	depth = 18000,
	color = "#180202:128",
--	no_armor = true;
	durability = 64000,
	power = 200,
	cooktime = 96,
})
but minetest 5.3 says:
Image

ThorfinnS
Member
Posts: 311
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by ThorfinnS » Post

It looks right on your character, just not on the armor stand? Or is that a problem, too?

Elektrika
Member
Posts: 52
Joined: Fri Sep 25, 2020 15:06
In-game: elektrika

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by Elektrika » Post

I am creating an ore randomizer mod that adds 100 new ores but I want to add special effects to armor, such as fire protection rating, heal, and higher jump along with other things. I also want to add stuff to tools like a chance of dropping something useful and adding the ability to light mobs on fire or to knock them back. I also want to be able to disable shards. The problem right now is that I am not that good with coding and I do not want to modify your mod to my needs if I don't have to. Can you add any optional special effects in the mod?
eh

User avatar
KatzEyez
Member
Posts: 50
Joined: Tue Aug 08, 2017 18:24
GitHub: KatzPetz
IRC: LadyK
In-game: LadyK
Location: (IG: Depends) (RL: USA)

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by KatzEyez » Post

barbas72n wrote:
Thu Aug 13, 2020 11:02
I have made myownium, for my server:

Code: Select all

instant_ores.register_metal({
	name = "gnu_slash_ores:myownium",
	description = "Myownium",
	rarity = 14,
	depth = 18000,
	color = "#180202:128",
--	no_armor = true;
	durability = 64000,
	power = 200,
	cooktime = 96,
})
but minetest 5.3 says:
Image
I am loving the ore name!!! Ingenious!
Why wish upon a star when you can pray to the one who created it.

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by sirrobzeroone » Post

barbas72n wrote:
Thu Aug 13, 2020 11:02

but minetest 5.3 says:
Image
I'm not sure if something has changed in 5.3 and minetest is now throwing an error but I can see why it is throwing an error - the image strings in the armor:register_armor() parts of instant_ores are cut off at the end example:

line 81 from init.lua

Code: Select all

texture = "3d_armor_dummy_image.png^(armor_chestplate.png^[colorize:"..color..")^3d_armor_dummy_image",
That last overlay is missing ".png". I tested by putting the .png back on the chestplate and now it is displayed on the armor stand. I haven't fully tested this but my guess is if you copy the below and paste over from:
line65 --local sanity=nil to
line110 in init.lua it should fix boots,helmets,leggings and chestplates.

Code: Select all

	--local sanity = nil
	armor:register_armor(":"..mod..":helmet_"..name, {
		description = desc.." Helmet",
		inventory_image = "armor_inv_helmet.png^[colorize:"..color,
		texture = "3d_armor_dummy_image.png^(armor_helmet.png^[colorize:"..color..")^3d_armor_dummy_image.png",
		 -- I'm not going to try to explain how this texture hack works. Really, it shouldn't.
		preview = "3d_armor_preview_dummy_image.png^(armor_helmet_preview.png^[colorize:"..color..")^3d_armor_preview_dummy_image.png",
		groups = {armor_head=1, armor_heal=0, armor_use=uses,
			physics_speed=-0.01*weight, physics_gravity=0.01*weight},
		reciprocate_damage = hurt_back,
		armor_groups = {fleshy=small_armor},
		damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=level},
	})
	armor:register_armor(":"..mod..":chestplate_"..name, {
		description = desc.." Chestplate",
		inventory_image = "armor_inv_chestplate.png^[colorize:"..color,
		texture = "3d_armor_dummy_image.png^(armor_chestplate.png^[colorize:"..color..")^3d_armor_dummy_image.png",
		preview = "3d_armor_preview_dummy_image.png^(armor_chestplate_preview.png^[colorize:"..color..")^3d_armor_preview_dummy_image.png",
		groups = {armor_torso=1, armor_heal=0, armor_use=uses,
			physics_speed=-0.04*weight, physics_gravity=0.04*weight},
		reciprocate_damage = hurt_back,
		armor_groups = {fleshy=big_armor},
		damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=level},
	})
	armor:register_armor(":"..mod..":leggings_"..name, {
		description = desc.." Leggings",
		inventory_image = "armor_inv_leggings.png^[colorize:"..color,
		texture = "3d_armor_dummy_image.png^(armor_leggings.png^[colorize:"..color..")^3d_armor_dummy_image.png",
		preview = "3d_armor_preview_dummy_image.png^(armor_leggings_preview.png^[colorize:"..color..")^3d_armor_preview_dummy_image.png",
		groups = {armor_legs=1, armor_heal=0, armor_use=uses,
			physics_speed=-0.03*weight, physics_gravity=0.03*weight},
		reciprocate_damage = hurt_back,
		armor_groups = {fleshy=big_armor},
		damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=level},
	})
	armor:register_armor(":"..mod..":boots_"..name, {
		description = desc.." Boots",
		inventory_image = "armor_inv_boots.png^[colorize:"..color,
		texture = "3d_armor_dummy_image.png^(armor_boots.png^[colorize:"..color..")^3d_armor_dummy_image.png",
		preview = "3d_armor_preview_dummy_image.png^(armor_boots_preview.png^[colorize:"..color..")^3d_armor_preview_dummy_image.png",
		groups = {armor_feet=1, armor_heal=0, armor_use=uses,
			physics_speed=-0.01*weight, physics_gravity=0.01*weight},
		reciprocate_damage = hurt_back,
		armor_groups = {fleshy=small_armor},
		damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=level},
	})
Shields look to be okay.

I had a look as Im poking around 3d_armor at the moment and wondered if it might be a 3d_armor bug. BTW really like this mod :)

Edit: I dont like not testing stuff - fix worked okay I am on 5.3
Image
Attachments
armor_instantores.png
armor_instantores.png (319.67 KiB) Viewed 2492 times

User avatar
BuckarooBanzay
Member
Posts: 435
Joined: Tue Apr 24, 2018 05:58
GitHub: BuckarooBanzay
IRC: BuckarooBanzai
In-game: BuckarooBanzai

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by BuckarooBanzay » Post

sirrobzeroone wrote:
Mon Dec 28, 2020 09:25
barbas72n wrote:
Thu Aug 13, 2020 11:02

but minetest 5.3 says:
Image
I'm not sure if something has changed in 5.3 and minetest is now throwing an error but I can see why it is throwing an error - the image strings in the armor:register_armor() parts of instant_ores are cut off at the end example:

line 81 from init.lua

Code: Select all

texture = "3d_armor_dummy_image.png^(armor_chestplate.png^[colorize:"..color..")^3d_armor_dummy_image",
That last overlay is missing ".png". I tested by putting the .png back on the chestplate and now it is displayed on the armor stand. I haven't fully tested this but my guess is if you copy the below and paste over from:
line65 --local sanity=nil to
line110 in init.lua it should fix boots,helmets,leggings and chestplates.

Code: Select all

	--local sanity = nil
	armor:register_armor(":"..mod..":helmet_"..name, {
		description = desc.." Helmet",
		inventory_image = "armor_inv_helmet.png^[colorize:"..color,
		texture = "3d_armor_dummy_image.png^(armor_helmet.png^[colorize:"..color..")^3d_armor_dummy_image.png",
		 -- I'm not going to try to explain how this texture hack works. Really, it shouldn't.
		preview = "3d_armor_preview_dummy_image.png^(armor_helmet_preview.png^[colorize:"..color..")^3d_armor_preview_dummy_image.png",
		groups = {armor_head=1, armor_heal=0, armor_use=uses,
			physics_speed=-0.01*weight, physics_gravity=0.01*weight},
		reciprocate_damage = hurt_back,
		armor_groups = {fleshy=small_armor},
		damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=level},
	})
	armor:register_armor(":"..mod..":chestplate_"..name, {
		description = desc.." Chestplate",
		inventory_image = "armor_inv_chestplate.png^[colorize:"..color,
		texture = "3d_armor_dummy_image.png^(armor_chestplate.png^[colorize:"..color..")^3d_armor_dummy_image.png",
		preview = "3d_armor_preview_dummy_image.png^(armor_chestplate_preview.png^[colorize:"..color..")^3d_armor_preview_dummy_image.png",
		groups = {armor_torso=1, armor_heal=0, armor_use=uses,
			physics_speed=-0.04*weight, physics_gravity=0.04*weight},
		reciprocate_damage = hurt_back,
		armor_groups = {fleshy=big_armor},
		damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=level},
	})
	armor:register_armor(":"..mod..":leggings_"..name, {
		description = desc.." Leggings",
		inventory_image = "armor_inv_leggings.png^[colorize:"..color,
		texture = "3d_armor_dummy_image.png^(armor_leggings.png^[colorize:"..color..")^3d_armor_dummy_image.png",
		preview = "3d_armor_preview_dummy_image.png^(armor_leggings_preview.png^[colorize:"..color..")^3d_armor_preview_dummy_image.png",
		groups = {armor_legs=1, armor_heal=0, armor_use=uses,
			physics_speed=-0.03*weight, physics_gravity=0.03*weight},
		reciprocate_damage = hurt_back,
		armor_groups = {fleshy=big_armor},
		damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=level},
	})
	armor:register_armor(":"..mod..":boots_"..name, {
		description = desc.." Boots",
		inventory_image = "armor_inv_boots.png^[colorize:"..color,
		texture = "3d_armor_dummy_image.png^(armor_boots.png^[colorize:"..color..")^3d_armor_dummy_image.png",
		preview = "3d_armor_preview_dummy_image.png^(armor_boots_preview.png^[colorize:"..color..")^3d_armor_preview_dummy_image.png",
		groups = {armor_feet=1, armor_heal=0, armor_use=uses,
			physics_speed=-0.01*weight, physics_gravity=0.01*weight},
		reciprocate_damage = hurt_back,
		armor_groups = {fleshy=small_armor},
		damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=level},
	})
Shields look to be okay.

I had a look as Im poking around 3d_armor at the moment and wondered if it might be a 3d_armor bug. BTW really like this mod :)

Edit: I dont like not testing stuff - fix worked okay I am on 5.3
Image
Just fyi: Piezo_ has quit minetest for good last time i checked, it may be worth migrating/adopting that mod to the "minetest-mods" github org
¯\_(ツ)_/¯ Not active here anymore, contact me on the minetest discord, irc, lemmy or github (for programming issues)

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by sirrobzeroone » Post

BuckarooBanzay wrote:
Mon Dec 28, 2020 09:47
Just fyi: Piezo_ has quit minetest for good last time i checked, it may be worth migrating/adopting that mod to the "minetest-mods" github org
that is a real shame, I really liked a number of his mods hopefully he returns one day. Yes it would be sad to lose this one.

I just did a quick update to init.lua so it used steel armor as it's base and overlays it's colors ontop of that, mainly to save on the maintenece for Piezo_ but also updated the armor to the new 3d_armor texture.

Given the above (ie Piezo_ left) I've uploaded a full zip fix version attached for the moment and if this gets adopted I'll push a fix through. oh I also changed from colorize to multiply thought the colors looked closer - gold for ref:

Image
Attachments
instant_ores.zip
(350.19 KiB) Downloaded 67 times
armor_instant_ores_two.png
armor_instant_ores_two.png (261.05 KiB) Viewed 2492 times

User avatar
sirrobzeroone
Member
Posts: 593
Joined: Mon Jul 16, 2018 07:56
GitHub: sirrobzeroone
Contact:

Re: [mod] Zero-Effort Custom Minerals [instant_ores]

by sirrobzeroone » Post

I sort of forked a copy of this across to my github repository, it was important to me that I kept the commit history intact as full credit for this mod belongs with Piezo_, I managed to make that work. So theres an unoffical fork located here:

https://github.com/sirrobzeroone/instant_ores

I've made some minor adjustments and will make some more as I start to understand the code and I think I can add some value.
  • Added mod.conf file
  • Removed depends.txt
  • Mod no longer needs bundled 3d_armor images and will use the "Steel armor" image as base and colorize on this this should mean if your using a texture pack the armors from instant_ores will look like colored steel versions from that texture pack
  • Minor adjustment to armor protection calc so you end up with nil decimal places on armor tab in game...unless your getting a 10% set bonus
  • Adjusted armor from colorize to multiply @ about 88% opacity overlay...closer to standard colors but who knows how that will blend with a texture pack
  • file name cleanups just so they sort nicer
I'll see if I can add a dedicated Readme.MD and see if I can do the same trick with tools that I did with armor as that will significantly lower maintenace overhead as well as make intergrating with a texture pack much easier. That may take me sometime as I'm upto my eyeballs in understanding 3d_armor for a game I'm developing :).

Once thats done I'll then put in an request to have the minetest-mods team pickup the looking after of the mod, hopefully it'll be accepted, but for now feel free to report any issues against my github version and I'll do my best to fix them...or at least they'll be documented - best to flag issues on github as I can sometimes have problems keeping up with all the forum posts.

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests