Entity Comparison or Communication

Thank you for taking the time to read this, I’ve been trying all day with no success. I am trying to compare two entities I’ve made. One a stove, another a barrel. It’s so pose to represent a stove that needs to be refueled with the barrel full of gas. I want to compare the vectors of the two entities and obtain the pythagorean distance.

Yes, I know “Vector:Distance( Vector(0,0,0), Vector(0,0,0))” but I can’t get both the needed vectors in one entity. I don’t fully understand the networking, I’ve tried using net messages. But I am almost curtain they don’t go outside the scope of the entity. I even looked into the “Entity:input” I can’t figure this out, please I need help.

What do you mean by ‘needed vectors’? Do you mean the entity’s position or some other thing related to the entity’s position?

The position of the two entities (vectors).

If you insist on using your current method of doing things you can do this in the stove thoughts to check if there’s a barrel in range:

for _,barrel in pairs( ents.FindByClass( "BARRELCLASSNAME" ) ) do
     if self:GetPos():Distance( barrel:GetPos() ) < MINIMUMDISTANCE then

But if you’re going to refuel a stove by having a minimum distance between the stove and the barrel, I would just suggest making it so the barrel has to come in contact with the stove and you’d play around with ENT:Touch() on the barrel

I tried the “ENT:Touch()” method, but once the prop seizes to move the function doesn’t return true. Though I guess I could use a toggle method. Beyond that, thank you for the help. I appreciate it.