pyrollo / late

Library Adding Temporary Effects to Minetest
GNU Lesser General Public License v2.1
5 stars 2 forks source link

Add effect_in #19

Open tacotexmex opened 5 years ago

tacotexmex commented 5 years ago

I want to apply an effect whenever a player is inside a node. effect_near with distance = 0 doesn't work. So support for being inside nodes would be useful.

pyrollo commented 5 years ago

Hi Tacotexmex, I added a "effect_in" thing for node doing effect when you are in.

This is a quick (and not so dirty) addition. For player it makes effect when players' eyes are in the node but I'm wondering if the target should be affected as soon as it touches the node (not sure how to do this, technically speaking).

Glad to see you're still working on something using late :)

tacotexmex commented 5 years ago

but I'm wondering if the target should be affected as soon as it touches the node (not sure how to do this, technically speaking).

I think "in" should count if player has feet or more inside the node. So two checks then, one for upper body and one for lower body.

Glad to see you're still working on something using late :)

Dude, I need to show you what I'm working on at some point!

tacotexmex commented 5 years ago

It works, but it's several seconds slow to begin when the condition is true while ending when condition is false is instant. 🤔

pyrollo commented 5 years ago

Yes, the problem is it uses an ABM to start effect but a global step to end it. ABM interval is set to 1s, it could be lowered to 0,3 (which is, IIRC the default ABM interval).

tacotexmex commented 5 years ago

I see. From what I've learned ABMs won't scale very well on a multiplayer server. Am I right? What are the benefits of using an ABM at all in these cases? (Both for effect_near and effect_in)

pyrollo commented 5 years ago

No benefit but no other way when dealing with mobs. I could have had a two mechanisms, one for players and one for mobs but that looked complicated.

The problem is trigger the creation of an effect (once started, it's properly tracked by Late). There is a way to know about connected players, but AFAIK no way to know about currently loaded entities.

pyrollo commented 5 years ago

Or maybe could I rely on a get_objects_inside_radius around each players. Then get mobs. That may be better for "in_node" performances. But for "near_node", I used the technic mod method for radioactivity. Nodes performing "near" effect should be kind of rare (magic nodes).

tacotexmex commented 5 years ago

Nodes performing "near" effect should be kind of rare (magic nodes).

That's another problem I'm experienceing as I want heat to spread around fire nodes, which are not rare but plenty. Of course I cannot have several fire nodes accumulating the heat because of how it's written. Is that something you would want to look into? I know that FaceDeer solved a similar case in radiant_damage.

tacotexmex commented 5 years ago

I think I'll try to employ an radiant_damage mod to calculate the radiance, but I'll use the damage value for heat instead.