Advertisement
JimDeadlock

BlockTrapRaid.cs

Jan 18th, 2025
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. using System;
  2. namespace Carbon.Plugins
  3. {
  4. [Info("BlockTrapRaid", "Juri", "1.0.0")]
  5. [Description("Blocks shotgun trap and auto turret damage to building blocks and doors")]
  6. public class BlockTrapRaid : CarbonPlugin
  7. {
  8. private const string AutoTurretPrefab = "assets/prefabs/npc/autoturret/autoturret_deployed.prefab";
  9. private const string ShotgunTrapPrefab = "assets/prefabs/deployable/single shot trap/guntrap.deployed.prefab";
  10.  
  11. private uint _AutoTurretPrefabId;
  12. private uint _ShotgunTrapPrefabId;
  13.  
  14. private void OnServerInitialized()
  15. {
  16. _AutoTurretPrefabId = StringPool.Get(AutoTurretPrefab);
  17. _ShotgunTrapPrefabId = StringPool.Get(ShotgunTrapPrefab);
  18. }
  19. private object OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitInfo)
  20. {
  21. if (hitInfo.Initiator != null)
  22. {
  23. if (hitInfo.Initiator.prefabID == _AutoTurretPrefabId || hitInfo.Initiator.prefabID == _ShotgunTrapPrefabId)
  24. {
  25. if (entity.GetType().Name == "BuildingBlock" || entity.GetType().Name == "Door")
  26. {
  27. return true;
  28. }
  29. }
  30. }
  31. return null;
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement