[Mod] Entity Control Function Library [entitycontrol]

Post Reply
User avatar
Posts: 50
Joined: Sun May 27, 2018 00:07
GitHub: Noodlemire
In-game: Noodlemire

[Mod] Entity Control Function Library [entitycontrol]

by Noodlemire » Post

As I was trying to fix falling beds in my mod [clumpfall], I realized that falling nodes don't call on_place due to using set_node when landing instead of place_node. Since the only mod that I could find that provides a way to override entities, [entity_override], has a dead repo and no other download links, I decided to make this quick mod to provide said function. Also made a method to unregister entities since I saw it on the to-do list of [entity_override] and hadn't found anything about that, either.

In order to use it, just install it in your preferred mods folder and add it as a dependency to your mod. There, you'll be able to use these functions however you please. With it, you'll be able to easily make changes to any mobs you please without needing to worry about

Example override:

Code: Select all

--Give dirt monsters a lot less maximum hp, but give them a ranged attack.
	hp_max = 15,
	attack_type = "dogshoot",
	dogshoot_switch = 1,
	dogshoot_count_max = 1, -- shoot for 1 second
	dogshoot_count2_max = 3, -- dogfight for 3 seconds while waiting between shots
	shoot_interval = 3,
	arrow = "modname:dirt_shot",
	shoot_offset = 1,

mobs:register_arrow("modname:dirt_shot", {
	visual = "sprite",
	visual_size = {x = 0.5, y = 0.5},
	textures = {"default_dirt.png"},
	velocity = 6,
	expire = 0.1,

	--Low damage hits
	hit_player = function(self, player)
		player:punch(self.object, 1.0, {
			full_punch_interval = 1.0,
			damage_groups = {fleshy = 8},
		}, nil)

	hit_mob = function(self, player)
		player:punch(self.object, 1.0, {
			full_punch_interval = 1.0,
			damage_groups = {fleshy = 8},
		}, nil)

	--Turns nodes into dirt
	hit_node = function(self, pos, node)
		minetest.set_node(pos, {name="default:dirt"})
If anyone want to see any other entity-related functions in this, feel free to provide suggestions.

Repository: https://github.com/Noodlemire/entitycontrol
License: Apache 2.0, https://github.com/Noodlemire/entitycon ... ICENSE.txt
Download: https://mega.nz/#!W25QmBiY!8RZA4IJjq4wG ... _11b-Y9mw0

Posts: 4127
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: [Mod] Entity Control Function Library [entitycontrol]

by Sokomine » Post

Could be intresting. I do have some problems with snowballs falling right next to fields with grown crops. Such a snowball can take an entire field down in one go :/
A list of my mods can be found here.

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

Re: [Mod] Entity Control Function Library [entitycontrol]

by texmex » Post

Thanks noodlemire!
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

Post Reply

Who is online

Users browsing this forum: Bing [Bot], ElCeejo and 5 guests