When picking cloth planted by a cutting, in a planter box, it would not trigger the OnCropGather hook.
Fixed OnCropGather not triggering for cloth
Discussion in 'Rust Development' started by Dubz, Jan 30, 2017.
-
Thats weird. It still seems to have the same code as before to execute OnCropGather:
Code:[BaseEntity.RPC_Server] [BaseEntity.RPC_Server.MaxDistance(3f)] public void RPC_PickFruit(BaseEntity.RPCMessage msg) { if (!this.CanPick()) return; ++this.harvests; int iAmount = Mathf.RoundToInt((this.currentStage.resources + this.YieldBonusScale() * (float) this.plantProperty.waterYieldBonus) * (float) this.plantProperty.pickupAmount); this.ResetSeason(); if (this.plantProperty.pickupItem.condition.enabled) { for (int index = 0; index < iAmount; ++index) { Item obj = ItemManager.Create(this.plantProperty.pickupItem, 1, 0UL); obj.conditionNormalized = this.plantProperty.fruitCurve.Evaluate(this.ageFraction); Interface.CallHook("OnCropGather", (object) this, (object) obj, (object) msg.player); msg.player.GiveItem(obj, BaseEntity.GiveItemReason.PickedUp); } } else { Item obj = ItemManager.Create(this.plantProperty.pickupItem, iAmount, 0UL); msg.player.GiveItem(obj, BaseEntity.GiveItemReason.PickedUp); } if (this.plantProperty.pickEffect.isValid) Effect.server.Run(this.plantProperty.pickEffect.resourcePath, this.GetEstimatedWorldPosition(), Vector3.up, (Connection) null, false); if (this.harvests >= this.plantProperty.maxHarvests) { if (this.plantProperty.disappearAfterHarvest) this.Die((HitInfo) null); else this.BecomeState(PlantProperties.State.Dying, true); } else this.BecomeState(PlantProperties.State.Mature, true); }
Code:// Decompiled with JetBrains decompiler // Type: PlanterBox // Assembly: Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null // MVID: C6C8FF52-32E3-43DB-9C16-FFEA5A992959 // Assembly location: C:\TheBreach\RustDedicated_Data\Managed\Assembly-CSharp.dllusing UnityEngine;public class PlanterBox : BaseCombatEntity, ISplashable { public int soilSaturationMax = 8000; public int soilSaturation; public MeshRenderer soilRenderer; public float soilSaturationFraction { get { return (float) this.soilSaturation / (float) this.soilSaturationMax; } } public override void Save(BaseNetworkable.SaveInfo info) { base.Save(info); info.msg.resource = Facepunch.Pool.Get<ProtoBuf.BaseResource>(); info.msg.resource.stage = this.soilSaturation; } public override void Load(BaseNetworkable.LoadInfo info) { base.Load(info); if (info.msg.resource == null) return; this.soilSaturation = info.msg.resource.stage; } public int UseWater(int amount) { int num = Mathf.Min(amount, this.soilSaturation); this.soilSaturation -= num; this.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); return num; } public bool wantsSplash(ItemDefinition splashType, int amount) { if (!(splashType.shortname == "water.salt")) return this.soilSaturation < this.soilSaturationMax; return true; } public int DoSplash(ItemDefinition splashType, int amount) { if (splashType.shortname == "water.salt") { this.soilSaturation = 0; this.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); return amount; } int num = Mathf.Min(this.soilSaturationMax - this.soilSaturation, Mathf.Min(amount, 500)); this.soilSaturation += num; this.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); return num; } }
-
I have made some local changes that should resolve this issue. The fix for this should normally be included in tomorrows update.