[How To] Make more items Magnetic/Shredable HDRP

Im not writing a plugin just for this stuff but here is how some one can easily add support of this to a exsisting plugin to save them time digging though the code to work it out.

Send chat command /mag will magnetize nearby Helicopters,Boats,Cranes. (It would probably be better to  magnetize them when they spawn instead)
https://www.youtube.com/watch?v=BhJ9L1jhnGA

[ChatCommand("mag")]
void AddMagCommand(BasePlayer player)
{
	//Check if Heli
	var minient = UnityEngine.Object.FindObjectOfType<BaseHelicopterVehicle>();
	if (minient != null)
	{
		var maglift = minient.gameObject.AddComponent<MagnetLiftable>();
		if (maglift != null)
		{
		maglift.shredResources = new ItemAmount[]{new ItemAmount(ItemManager.FindItemDefinition("scrap"), 100)}; //Outputs 100 Scrap on shread
		player.ChatMessage("<color=red>Magnetized " + minient.ToString()+"</color>");
		}
	}

	//Check if Boat
	var boatent = UnityEngine.Object.FindObjectOfType<MotorRowboat>();
	if (boatent != null)
	{	
		var maglift = boatent.gameObject.AddComponent<MagnetLiftable>();
		if (maglift != null)
		{
		maglift.shredResources = new ItemAmount[]{new ItemAmount(ItemManager.FindItemDefinition("scrap"), 90)}; //Outputs 90 Scrap on shread
		player.ChatMessage("<color=red>Magnetized " + boatent.ToString()+"</color>");
		}	
	}

	//Check if Crane
	var crainent = UnityEngine.Object.FindObjectOfType<BaseCrane>();
	if (crainent != null)
	{
		var maglift = crainent.gameObject.AddComponent<MagnetLiftable>();
		if (maglift != null)
		{
		maglift.shredResources = new ItemAmount[]{new ItemAmount(ItemManager.FindItemDefinition("scrap"), 80)}; //Outputs 80 Scrap on shread
		player.ChatMessage("<color=red>Magnetized " + crainent.ToString()+"</color>");
		}
	}
 }

Did you ever try adding the MagnetLiftable component to a player?  Shredding people for meat would be interesting.

Nope not tried that yet.
But I ended up just setting there scrap value onspawn since on my server you can spawn stuff in via button. Which would mean people could just farm there spawns.

So for boats iv done this.

void OnEntitySpawned(MotorRowboat boat)
    {
      if (boat != null)
      {
	var maglift = boat.gameObject.AddComponent<MagnetLiftable>();
       	if (maglift != null)
        {
	BasePlayer player = BasePlayer.FindByID(boat.OwnerID);
	if(player ==null)
	{
         maglift.shredResources = new ItemAmount[] {new ItemAmount(ItemManager.FindItemDefinition("scrap"), 100)}; //Outputs 100 Scrap on shread
	return;
	}
	if (BasePlayer.activePlayerList.Contains(player))//(_data.playerMini.ContainsKey(boat.net.ID))
	{
	maglift.shredResources = new ItemAmount[] {new ItemAmount(ItemManager.FindItemDefinition("horsedung"), 1)}; 
	}	
	else
	{
         maglift.shredResources = new ItemAmount[] {new ItemAmount(ItemManager.FindItemDefinition("scrap"), 100)}; //Outputs 100 Scrap on shread
	}
        }
      }
    }​

Just add another void for each Vehicle you want, Such as helis would be void OnEntitySpawned(BaseHelicopterVehicle helicopter)

lol sounds awesome while i cant even sit in the crane ...

Had some time to play with attaching it to other things.

Attaching it to players when they spawn some what works.
You can lift them up slightly then it flyhack kicks them. So youd need to do something to temp disable it while they are with in a radius of a crane or something like that.

BotSpawn bots attching it to them. They lift up to about knee height. Then the crane goes crazy and spins around in the air.
HumanNPC bots same as above except they never lift off the ground at all. They are locked in place and it makes the crane go crazy flying around.

None of them will trigger going though the shredder. But I see there is a shredder setting for NPC that I havnt played with yet.

Might be possible to make a BaseMountable, and put the player into that.  Perhaps stop them from moving and disable the flyhack checks.  Will have to play with it when I have a moment.

You can put them on a chair. But they look a bit silly and seem to have a lot more mass then they should since you can tip over the crane very easily.
Ideally you would trigger that when they are with in a radius of the magnet.

Have to set the mountPose to SitSummer_BoogieBoard.