public void FillCheck() { if (base.isClient) { return; } BasePlayer ownerPlayer = base.GetOwnerPlayer(); if (!ownerPlayer) { return; } float single = UnityEngine.Time.realtimeSinceStartup - this.lastFillTime; Vector3 vector3 = ownerPlayer.transform.position - new Vector3(0f, 1f, 0f); if (this.CanFillFromWorld()) { this.AddLiquid(WaterResource.GetAtPoint(vector3), Mathf.FloorToInt(single * this.fillMlPerSec)); return; } LiquidContainer facingLiquidContainer = this.GetFacingLiquidContainer(); if (facingLiquidContainer != null && facingLiquidContainer.HasLiquidItem()) { int num = Mathf.CeilToInt((1f - this.HeldFraction()) * (float)this.MaxHoldable()); if (num > 0) { Item liquidItem = facingLiquidContainer.GetLiquidItem(); int num1 = Mathf.Min(Mathf.CeilToInt(single * this.fillMlPerSec), Mathf.Min(liquidItem.amount, num)); this.AddLiquid(liquidItem.info, num1); liquidItem.UseItem(num1); facingLiquidContainer.OpenTap(2f); } } }
public void StartFilling() { float num = UnityEngine.Time.realtimeSinceStartup - lastFillTime; StopFilling(); InvokeRepeating(FillCheck, 0f, 0.3f); if (num > 1f) { LiquidContainer facingLiquidContainer = GetFacingLiquidContainer(); if (facingLiquidContainer != null && facingLiquidContainer.GetLiquidItem() != null) { if (fillFromContainer.isValid) { Effect.server.Run(fillFromContainer.resourcePath, facingLiquidContainer.transform.position, Vector3.up); } ClientRPC(null, "CLIENT_StartFillingSoundsContainer"); } else if (CanFillFromWorld()) { if (fillFromWorld.isValid) { Effect.server.Run(fillFromWorld.resourcePath, GetOwnerPlayer(), 0u, Vector3.zero, Vector3.up); } ClientRPC(null, "CLIENT_StartFillingSoundsWorld"); } } lastFillTime = UnityEngine.Time.realtimeSinceStartup; }
public void StartFilling() { float single = UnityEngine.Time.realtimeSinceStartup - this.lastFillTime; this.StopFilling(); base.InvokeRepeating(new Action(this.FillCheck), 0f, 0.3f); if (single > 1f) { LiquidContainer facingLiquidContainer = this.GetFacingLiquidContainer(); if (facingLiquidContainer != null && facingLiquidContainer.GetLiquidItem() != null) { Effect.server.Run(this.fillFromContainer.resourcePath, facingLiquidContainer.transform.position, Vector3.up, null, false); } else if (this.CanFillFromWorld()) { Effect.server.Run(this.fillFromWorld.resourcePath, base.GetOwnerPlayer(), 0, Vector3.zero, Vector3.up, null, false); } } this.lastFillTime = UnityEngine.Time.realtimeSinceStartup; }
public void StartFilling() { double num = (double)Time.get_realtimeSinceStartup() - (double)this.lastFillTime; this.StopFilling(); this.InvokeRepeating(new Action(this.FillCheck), 0.0f, 0.3f); if (num > 1.0) { LiquidContainer facingLiquidContainer = this.GetFacingLiquidContainer(); if (Object.op_Inequality((Object)facingLiquidContainer, (Object)null) && facingLiquidContainer.GetLiquidItem() != null) { Effect.server.Run(this.fillFromContainer.resourcePath, ((Component)facingLiquidContainer).get_transform().get_position(), Vector3.get_up(), (Connection)null, false); } else if (this.CanFillFromWorld()) { Effect.server.Run(this.fillFromWorld.resourcePath, (BaseEntity)this.GetOwnerPlayer(), 0U, Vector3.get_zero(), Vector3.get_up(), (Connection)null, false); } } this.lastFillTime = Time.get_realtimeSinceStartup(); }
public void FillCheck() { if (base.isClient) { return; } BasePlayer ownerPlayer = GetOwnerPlayer(); if (!ownerPlayer) { return; } float f = (UnityEngine.Time.realtimeSinceStartup - lastFillTime) * fillMlPerSec; Vector3 pos = ownerPlayer.transform.position - new Vector3(0f, 1f, 0f); LiquidContainer facingLiquidContainer = GetFacingLiquidContainer(); if (Interface.CallHook("OnLiquidVesselFill", this, ownerPlayer, facingLiquidContainer) != null) { return; } if (facingLiquidContainer == null && CanFillFromWorld()) { AddLiquid(WaterResource.GetAtPoint(pos), Mathf.FloorToInt(f)); } else if (facingLiquidContainer != null && facingLiquidContainer.HasLiquidItem()) { int num = Mathf.CeilToInt((1f - HeldFraction()) * (float)MaxHoldable()); if (num > 0) { Item liquidItem = facingLiquidContainer.GetLiquidItem(); int num2 = Mathf.Min(Mathf.CeilToInt(f), Mathf.Min(liquidItem.amount, num)); AddLiquid(liquidItem.info, num2); liquidItem.UseItem(num2); facingLiquidContainer.OpenTap(2f); } } lastFillTime = UnityEngine.Time.realtimeSinceStartup; }
public void FillCheck() { if (this.isClient) { return; } BasePlayer ownerPlayer = this.GetOwnerPlayer(); if (!Object.op_Implicit((Object)ownerPlayer)) { return; } float num1 = Time.get_realtimeSinceStartup() - this.lastFillTime; Vector3 pos = Vector3.op_Subtraction(((Component)ownerPlayer).get_transform().get_position(), new Vector3(0.0f, 1f, 0.0f)); if (this.CanFillFromWorld()) { this.AddLiquid(WaterResource.GetAtPoint(pos), Mathf.FloorToInt(num1 * this.fillMlPerSec)); } else { LiquidContainer facingLiquidContainer = this.GetFacingLiquidContainer(); if (!Object.op_Inequality((Object)facingLiquidContainer, (Object)null) || !facingLiquidContainer.HasLiquidItem()) { return; } int num2 = Mathf.CeilToInt((1f - this.HeldFraction()) * (float)this.MaxHoldable()); if (num2 <= 0) { return; } Item liquidItem = facingLiquidContainer.GetLiquidItem(); int num3 = Mathf.Min(Mathf.CeilToInt(num1 * this.fillMlPerSec), Mathf.Min(liquidItem.amount, num2)); this.AddLiquid(liquidItem.info, num3); liquidItem.UseItem(num3); facingLiquidContainer.OpenTap(2f); } }