if(entity is WaterPump)
{
var TC = entity.GetComponentInParent<LiquidContainer>();
var location = entity.GetComponentInParent<Vector3>();
if (TC.inventory == null) { Puts("not right"); return; }
var fuel = ItemManager.CreateByName("water", 50);
if(location.y > 1)
timer.Every(20f, () =>
{
fuel.MoveToContainer(TC.inventory);
});
}
I only want this code to work if the pump is above the ocean level, the way I did it above is spitting out errors, how would I get the vector3 of the entity? the hook is OnEntitySpawned.
{
var TC = entity.GetComponentInParent<LiquidContainer>();
var location = entity.GetComponentInParent<Vector3>();
if (TC.inventory == null) { Puts("not right"); return; }
var fuel = ItemManager.CreateByName("water", 50);
if(location.y > 1)
timer.Every(20f, () =>
{
fuel.MoveToContainer(TC.inventory);
});
}
I only want this code to work if the pump is above the ocean level, the way I did it above is spitting out errors, how would I get the vector3 of the entity? the hook is OnEntitySpawned.