Disabling vomit effect?
Hi everyone,

I would have liked to know if it was possible to capture the vomit event, transform it and why not recreate it?

Thanks :)
I dont think its possible, you can track it by changing metabolism

Also check WaterResource.cs in Assembly-CSharp.dll

I found this :

using System;
using UnityEngine;

// Token: 0x020005FE RID: 1534
public class WaterResource
{
	// Token: 0x060021C5 RID: 8645 RVA: 0x000B4680 File Offset: 0x000B2880
	public static global::ItemDefinition GetAtPoint(Vector3 pos)
	{
		bool flag = global::WaterResource.IsFreshWater(pos);
		return global::ItemManager.FindItemDefinition((!flag) ? "water.salt" : "water");
	}

	// Token: 0x060021C6 RID: 8646 RVA: 0x000B46B0 File Offset: 0x000B28B0
	public static bool IsFreshWater(Vector3 pos)
	{
		return !(global::TerrainMeta.TopologyMap == null) && global::TerrainMeta.TopologyMap.GetTopology(pos, 245760);
	}

	// Token: 0x060021C7 RID: 8647 RVA: 0x000B46D4 File Offset: 0x000B28D4
	public static global::ItemDefinition Merge(global::ItemDefinition first, global::ItemDefinition second)
	{
		if (first == second)
		{
			return first;
		}
		bool flag = first.shortname == "water.salt" || second.shortname == "water.salt";
		if (flag)
		{
			return global::ItemManager.FindItemDefinition("water.salt");
		}
		return global::ItemManager.FindItemDefinition("water");
	}
}


After find item definition of water.salt

	// Token: 0x06002333 RID: 9011 RVA: 0x000BB818 File Offset: 0x000B9A18
	public static global::ItemDefinition FindItemDefinition(string shortName)
	{
		global::ItemManager.Initialize();
		for (int i = 0; i < global::ItemManager.itemList.Count; i++)
		{
			if (global::ItemManager.itemList[i].shortname == shortName)
			{
				return global::ItemManager.itemList[i];
			}
		}
		return null;
	}

Get the inventory definition of water.salt ?

	// Token: 0x170002D6 RID: 726
	// (get) Token: 0x06002282 RID: 8834 RVA: 0x000B88B8 File Offset: 0x000B6AB8
	public Inventory.Definition[] skins2
	{
		get
		{
			if (this._skins2 != null)
			{
				return this._skins2;
			}
			if (Global.SteamServer != null && Global.SteamServer.Inventory.Definitions != null)
			{
				string prefabname = base.name;
				this._skins2 = (from x in Global.SteamServer.Inventory.Definitions
				where (x.GetStringProperty("itemshortname") == this.shortname || x.GetStringProperty("itemshortname") == prefabname) && !string.IsNullOrEmpty(x.GetStringProperty("workshopdownload"))
				select x).ToArray<Inventory.Definition>();
			}
			return this._skins2;
		}
	}


After this i'm loose :/.  Am I on the right way?


Edit : I found this in ItemModConsum, I keep looking.

using System;
using Rust;
using UnityEngine;

// Token: 0x0200063B RID: 1595
[RequireComponent(typeof(global::ItemModConsumable))]
public class ItemModConsume : global::ItemMod
{
	// Token: 0x060022C0 RID: 8896 RVA: 0x000B916C File Offset: 0x000B736C
	public virtual global::ItemModConsumable GetConsumable()
	{
		if (this.primaryConsumable)
		{
			return this.primaryConsumable;
		}
		return base.GetComponent<global::ItemModConsumable>();
	}

	// Token: 0x060022C1 RID: 8897 RVA: 0x000B918C File Offset: 0x000B738C
	public virtual global::GameObjectRef GetConsumeEffect()
	{
		return this.consumeEffect;
	}

	// Token: 0x060022C2 RID: 8898 RVA: 0x000B9194 File Offset: 0x000B7394
	public override void DoAction(global::Item item, global::BasePlayer player)
	{
		if (item.amount < 1)
		{
			return;
		}
		global::GameObjectRef gameObjectRef = this.GetConsumeEffect();
		if (gameObjectRef.isValid)
		{
			Vector3 posLocal = (!player.IsDucked()) ? new Vector3(0f, 2f, 0f) : new Vector3(0f, 1f, 0f);
			global::Effect.server.Run(gameObjectRef.resourcePath, player, 0u, posLocal, Vector3.zero, null, false);
		}
		player.metabolism.MarkConsumption();
		global::ItemModConsumable consumable = this.GetConsumable();
		float num = (float)Mathf.Max(consumable.amountToConsume, 1);
		float num2 = Mathf.Min((float)item.amount, num);
		float num3 = num2 / num;
		float num4 = item.conditionNormalized;
		if (consumable.conditionFractionToLose > 0f)
		{
			num4 = consumable.conditionFractionToLose;
		}
		foreach (global::ItemModConsumable.ConsumableEffect consumableEffect in consumable.effects)
		{
			if (player.healthFraction <= consumableEffect.onlyIfHealthLessThan)
			{
				if (consumableEffect.type == global::MetabolismAttribute.Type.Health)
				{
					if (consumableEffect.amount < 0f)
					{
						player.OnAttacked(new global::HitInfo(player, player, Rust.DamageType.Generic, -consumableEffect.amount * num3 * num4, player.transform.position + player.transform.forward * 1f));
					}
					else
					{
						player.health += consumableEffect.amount * num3 * num4;
					}
				}
				else
				{
					player.metabolism.ApplyChange(consumableEffect.type, consumableEffect.amount * num3 * num4, consumableEffect.time * num3 * num4);
				}
			}
		}
		if (this.product != null)
		{
			foreach (global::ItemAmountRandom itemAmountRandom in this.product)
			{
				int num5 = Mathf.RoundToInt((float)itemAmountRandom.RandomAmount() * num4);
				if (num5 > 0)
				{
					global::Item item2 = global::ItemManager.Create(itemAmountRandom.itemDef, num5, 0UL);
					player.GiveItem(item2, global::BaseEntity.GiveItemReason.Generic);
				}
			}
		}
		if (string.IsNullOrEmpty(this.eatGesture))
		{
			player.SignalBroadcast(global::BaseEntity.Signal.Gesture, this.eatGesture, null);
		}
		if (consumable.conditionFractionToLose > 0f)
		{
			item.LoseCondition(consumable.conditionFractionToLose * item.maxCondition);
		}
		else
		{
			item.UseItem((int)num2);
		}
	}

	// Token: 0x060022C3 RID: 8899 RVA: 0x000B9434 File Offset: 0x000B7634
	public override bool CanDoAction(global::Item item, global::BasePlayer player)
	{
		return player.metabolism.CanConsume();
	}

	// Token: 0x04001A6E RID: 6766
	public global::GameObjectRef consumeEffect;

	// Token: 0x04001A6F RID: 6767
	public string eatGesture = "eat_2hand";

	// Token: 0x04001A70 RID: 6768
	[Tooltip("Items that are given on consumption of this item")]
	public global::ItemAmountRandom[] product;

	// Token: 0x04001A71 RID: 6769
	public global::ItemModConsumable primaryConsumable;
}
if (gameObjectRef.isValid)
		{
			Vector3 posLocal = (!player.IsDucked()) ? new Vector3(0f, 2f, 0f) : new Vector3(0f, 1f, 0f);
			global::Effect.server.Run(gameObjectRef.resourcePath, player, 0u, posLocal, Vector3.zero, null, false);
		}

With a really quick look I think this is where the effect is ran so my guess is, if you really want to disable the sound you could modify the assembly or add a suggestion to add it (Not sure where you post those these days...)

In response to Sorrow ():
Hi everyone,

I would have liked to know if it was possible to capture the vomit event, tr...

The "vomit" is as a "gesture" part of the "signals": 

// BaseEntity.Signal
public const global::BaseEntity.Signal Gesture = 12;

This is used in conjunction, beside weapon actions, with this function:

// BaseEntity
public void SignalBroadcast(global::BaseEntity.Signal signal, string arg, Connection sourceConnection = null)

Going "back" from there in the code you will find what you need ;)

Thanks @FuJiCuRa, but i don't know how to use it.

I try this but but that's not the right way to listen to the event.

        void OnItemUse(Item item, int amountToUse)
        {
            var owner = item.parent?.playerOwner;
            if (owner == null) return;
            Puts(owner?.displayName + " | " + item.info.displayName.english + " | " + amountToUse);

            if (item.info.shortname == "jar.pickle")
            {

            }
        }

        public void SignalBroadcast(global::BaseEntity.Signal signal, string arg, Connection sourceConnection = null)
        {
            Puts(signal.ToString() + " " + arg + " " + sourceConnection?.player.name);

        }​


Merged post

Up, it's possible to hook SignalBroadcast ?