Solved hurtevent.entity.destroy > metal window bar (solved)

destroying it like that isn't correct though it works.

Try
C#:
NetCull.Destroy((entity.Object as DeployableObject).gameObject);
or Entity.Destory() on a wooden foundation with a furnace on it. you'll see how easy peasy the furnace doesn't get destroyed.

you will have floating items

C#:
NetCull.Destroy((entity.Object as DeployableObject).gameObject);

is only a cheap trick to destroy the metal window bar but i do not advise it to use.

That calls destroy for all clients and should work fine. I recommend you taking a look at the code with dotPeek.

What do you think that Entity.Destoy() uses ?

Entity.Destroy() checks if the object has a death effect. If so, it sends an RPC to all clients calling this effect and then calls Netcull.Destroy(). Finally, if the object should have a corpse, it instantiates it.
 
That being said, if it fails somewhere it calls Netcull.Destroy() directly, as it is in a try-catch.
 
have you tried using destroy on a wooden foundation with a furnace or any oher item on it?
 
have you tried using destroy on a wooden foundation with a furnace or any oher item on it?

No, but this post is about metal window bars.

Note that DeployableObject and StructureComponent handle destroy in a different way, and as you said before, Metal Window Bars are DeployableObject.
 
No, but this post is about metal window bars.

ofcouse, it is. but only saying that NetCull.Destroy((entity.Object as DeployableObject).gameObject); works
doesn't really explain why Onkilled() in Entity.Destroy / <DeployableObject> doesn't work properly on the metal window bar
 
C#:
if (this.IsDeployableObject())
    NetCull.Destroy(Entity.GetObject<DeployableObject>().networkViewID);
if (this.IsStructureMaster())
    NetCull.Destroy(Entity.GetObject<StructureMaster>().networkViewID);
 
ofcouse, it is. but only saying that NetCull.Destroy((entity.Object as DeployableObject).gameObject); works
doesn't really explain why Onkilled() in Entity.Destroy / <DeployableObject> doesn't work properly on the metal window bar

I didn't ment to explain why it doesn't, I just said a way to do it.

And it will probably not work because handleDeathHere property is false.

You can test that accesing (entity.Object as DeployableObject).handleDeathHere.
 
Entity.Destroy() doesn't use netcull, just when It fails to destroy It.

https://github.com/Notulp/Fougerite/blob/master/Fougerite/Fougerite/Entity.cs#L99

Netcull Itself will never call destroyevent.


--

Btw: util.DestroyObject(hurtEvent.Entity.Object.gameObject);

Forgot that you are on C# and It doesn't detect that without casting.


It does. Mainly it calls OnKilled, which is :

2015-05-10_1505.png


If it fails, it calls directly Netcull.Destroy()
 
I didn't ment to explain why it doesn't, I just said a way to do it.

And it will probably not work because handleDeathHere property is false.

You can test that accesing (entity.Object as DeployableObject).handleDeathHere.

And now that I think that again, you can also :

C#:
(entity.Object as DeployableObject).handleDeathhere = true;

entity.Destroy();
 
I didn't ment to explain why it doesn't, I just said a way to do it.

And it will probably not work because handleDeathHere property is false.

You can test that accesing (entity.Object as DeployableObject).handleDeathHere.

You basicallybasically summarize what i just said in a post explaining why onkilled didn't work for the metla window bar using OnKilled from Entity.Destroy.
 
Remember guys that probably we all using English as a second language and it's normal that we have problems with understanding and explaining.

Sometimes we all talking about same thing, sometimes we all talking about different things.

Just to clear :)
 
  • Agree
Reactions: Snake and Jakkee