public override void OnSoftImpact(MaterialThing with, ImpactedFrom from) { if (from == ImpactedFrom.Bottom && (double)this.hitWait == 0.0 && with.isServerForObject) { with.Fondle((Thing)this); } if (!this.isServerForObject || from != ImpactedFrom.Bottom || (double)this.hitWait != 0.0) { return; } this.hitWait = 1f; switch (with) { case Holdable holdable when holdable.lastThrownBy != null || holdable is RagdollPart && !Network.isActive: Duck lastThrownBy = holdable.lastThrownBy as Duck; if (holdable is RagdollPart) { break; } if (lastThrownBy != null) { PurpleBlock.StoreItem(lastThrownBy.profile, (Thing)with); } this.Bounce(); break; case Duck duck: StoredItem storedItem = PurpleBlock.GetStoredItem(duck.profile); if (storedItem.type != (System.Type)null && !this._served.Contains(duck.profile)) { this.contains = storedItem.type; this._contextThing = storedItem.thing; this.Pop(); this._hit = false; this._served.Add(duck.profile); } else { if (this._served.Contains(duck.profile)) { SFX.Play("scanFail"); } this.Bounce(); } if (duck.holdObject == null) { break; } Holdable holdObject = duck.holdObject; if (holdObject == null) { break; } PurpleBlock.StoreItem(duck.profile, (Thing)holdObject); break; } }
public override void OnSolidImpact(MaterialThing with, ImpactedFrom from) { with.Fondle((Thing)this); if (from == ImpactedFrom.Top && (double)with.totalImpactPower + (double)this.totalImpactPower > 0.100000001490116 && this._sprite.currentAnimation == "idle") { this.activated = true; this._sprite.SetAnimation("activate"); SFX.Play("click"); this.collisionOffset = new Vec2(-8f, -8f); this.collisionSize = new Vec2(16f, 15f); } base.OnSolidImpact(with, from); }