Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Carbon.Plugins
- {
- [Info("BlockTrapRaid", "Juri", "1.0.0")]
- [Description("Blocks shotgun trap and auto turret damage to building blocks and doors")]
- public class BlockTrapRaid : CarbonPlugin
- {
- private const string AutoTurretPrefab = "assets/prefabs/npc/autoturret/autoturret_deployed.prefab";
- private const string ShotgunTrapPrefab = "assets/prefabs/deployable/single shot trap/guntrap.deployed.prefab";
- private uint _AutoTurretPrefabId;
- private uint _ShotgunTrapPrefabId;
- private void OnServerInitialized()
- {
- _AutoTurretPrefabId = StringPool.Get(AutoTurretPrefab);
- _ShotgunTrapPrefabId = StringPool.Get(ShotgunTrapPrefab);
- }
- private object OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitInfo)
- {
- if (hitInfo.Initiator != null)
- {
- if (hitInfo.Initiator.prefabID == _AutoTurretPrefabId || hitInfo.Initiator.prefabID == _ShotgunTrapPrefabId)
- {
- if (entity.GetType().Name == "BuildingBlock" || entity.GetType().Name == "Door")
- {
- return true;
- }
- }
- }
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement