Optimization of effect handlingSolved

Instead of making strange and dangerous code you can set effect for explosion to NULL and then run effect manually to specific players

Could you elaborate?

What is strange and dangerous?

eiOxjtn9WCrgsgk.png 1AK1

Could you elaborate?

What is strange and dangerous?

You are disabling standart logic of explosions and adding your own. One day that will stop working and everyone will complain why their EXPLOSIVES not working

Thats true. 
This plugin was just made for my build server, as there was nothing out there to do what I wanted, and wanted to share it.

When it does stop working, then I could fix it.

Also, anyone can take a look at the code, it does not contain anything dangerous.

But thanks for the suggestion. 

fzMcXWVloAePecM.png 1AK1

Thats true. 
This plugin was just made for my build server, as there was nothing out there to do what I wanted, and wanted to share it.

When it does stop working, then I could fix it.

Also, anyone can take a look at the code, it does not contain anything dangerous.

But thanks for the suggestion. 

Bud, you don't get it, whole realization is not stable and dangerous because it can fuckup server. To make it RIGHT, you need just to make effect null and run it manually when its needed

MEjIm6MnuAI6gTh.png Orange

Bud, you don't get it, whole realization is not stable and dangerous because it can fuckup server. To make it RIGHT, you need just to make effect null and run it manually when its needed

Could you provide an example of what you mean or how you would do it?
As I don't really understand. 
dv0bu3KUCmLlPxl.png 1AK1
Could you provide an example of what you mean or how you would do it?
As I don't really understand. 

C4 or Rocket have effect that it runs on exploding, set it to null
Then get name of that effect and play it when it explodes

Something like this:

void OnEntitySpawned(TimedExplosive explosive)
{
    explosive.explosionEffect.guid = null;
}

Not sure off the top of my head what the best way to detect the explosion would be, but you could try simply hooking OnEntityKill(TimedExplosive) and then sending the effect to the player equal to explosive.creatorEntity. Not sure if there are cases where the explosives can be killed without exploding (such as another plugin killing them on spawn), in which case sending the effect would be wrong, but that's ultimately a low risk issue since worst case there are additional effects going off that do no damage.

9NNVrKgdmAgxgzM.jpg WhiteThunder

Something like this:

void OnEntitySpawned(TimedExplosive explosive)
{
    explosive.explosionEffect.guid = null;
}

Not sure off the top of my head what the best way to detect the explosion would be, but you could try simply hooking OnEntityKill(TimedExplosive) and then sending the effect to the player equal to explosive.creatorEntity. Not sure if there are cases where the explosives can be killed without exploding (such as another plugin killing them on spawn), in which case sending the effect would be wrong, but that's ultimately a low risk issue since worst case there are additional effects going off that do no damage.

Better monobehaviour + OnDestroy

67sKXL7PzLCnuC4.jpg WhiteThunder

Something like this:

void OnEntitySpawned(TimedExplosive explosive)
{
    explosive.explosionEffect.guid = null;
}

Not sure off the top of my head what the best way to detect the explosion would be, but you could try simply hooking OnEntityKill(TimedExplosive) and then sending the effect to the player equal to explosive.creatorEntity. Not sure if there are cases where the explosives can be killed without exploding (such as another plugin killing them on spawn), in which case sending the effect would be wrong, but that's ultimately a low risk issue since worst case there are additional effects going off that do no damage.

QEelSUH6TV06TbE.png Orange

Better monobehaviour + OnDestroy

Thanks guys, will take a look
Locked automatically