示例#1
0
        object OnHealingItemUse(MedicalTool tool, BasePlayer player)
        {
            if (!permission.UserHasPermission(player.UserIDString, permissionName))
            {
                return(null);
            }                                                                                      // Checks if the player using a healing item has permission


            switch (tool.GetItem()?.info.shortname)                                 // Switch out the tool that the player is using
            {
            case "syringe.medical":                                                 // If the tool the player is using matches this shrotname, then it will continue below
                player.health += syringeHealAmount;                                 // Adds the new healing amount to the player
                player.metabolism.pending_health.value   += syringePendingAmount;   // Adds pending health to the player
                player.metabolism.radiation_poison.value -= syringeRadRemoveAmount; // Removes a set amount of radiation from the player
                if (syringeBleedCancel)                                             // Checks if this is set true in the config
                {
                    player.metabolism.bleeding.value = 0f;                          // Sets bleeding to 0 if true in the config
                }
                break;

            case "bandage":     // Same as above
                player.health += bandageHealAmount;
                player.metabolism.pending_health.value += bandagePendingAmount;
                player.metabolism.bleeding.value        = 0f;
                break;
            }
            ;

            #region unused
            // This below is useless, don't bother reading it, it is placed elsewhere

            /*if (tool.GetItem()?.info.shortname.Contains("syringe") == true) // Checks that the tool is a syringe
             * {
             *  player.health += syringeHealAmount; // Adds the new healing amount to the player
             *  player.metabolism.pending_health.value += syringePendingAmount; // Adds pending health to the player
             *  player.metabolism.radiation_poison.value -= syringeRadRemoveAmount; // Removes a set amount of radiation from the player
             *  if (syringeBleedCancel) // Checks if this is set true in the config
             *  {
             *      player.metabolism.bleeding.value = 0f; // Sets bleeding to 0 if true in the config
             *  }
             *
             * }
             *
             * else if (tool.GetItem()?.info.shortname.Contains("bandage") == true) // Additional check to see if it's a bandage instead
             * {
             *
             *  player.health += bandageHealAmount;
             *  player.metabolism.pending_health.value += bandagePendingAmount;
             *  player.metabolism.bleeding.value = 0f;
             *
             * }*/
            /*else if (tool.GetItem()?.info.shortname.Contains("medkit") == true)
             * {
             *  player.metabolism.pending_health.value = medkitPendingAmount;
             * }*/
            #endregion
            return(true); // Returns true if there's a healing item that the plugin doesn't handle (should be all of them)
        }
//////////////////////////////////////////////////////

        void OnHealingItemUse(MedicalTool tool, BasePlayer player)
        {
            bool tweaker = permission.UserHasPermission(player.UserIDString, MedicalTweaker);

            if (tweaker)
            {
                tool.maxDistanceOther  = maxdistanceother;  //2  serynge +bandage//
                tool.healDurationSelf  = healdurationself;  //4
                tool.healDurationOther = healdurationother; //4
                tool.canRevive         = canrevive;         //false
                tool.canUseOnOther     = canuseonother;     //true
            }
        }
示例#3
0
 void OnHealingItemUse(MedicalTool tool, BasePlayer player)
 {
     if (tool.ShortPrefabName == "syringe_medical.entity")
     {
         var healingPlayer = tool.GetOwnerPlayer();
         if (healingPlayer != null)
         {
             if (permission.UserHasPermission(healingPlayer.UserIDString, "medicrevive.use"))
             {
                 player.StopWounded();
             }
         }
     }
 }
//////////////////////////////////

        object OnHealingItemUse(MedicalTool tool, BasePlayer player)
        {
            bool noheal = permission.UserHasPermission(player.UserIDString, CanNotUseMedical);

            if (noheal)
            {
                if (debug)
                {
                    Puts($"OnHealingItemUse nulled for - {player.displayName}");
                }
                return(true);
            }
            else
            {
                return(null);
            }
        }
示例#5
0
 private object IOnPlayerRevive(MedicalTool tool, BasePlayer target) => Interface.Call("OnPlayerRevive", tool.GetOwnerPlayer(), target);
示例#6
0
        /// <summary>
        /// Called from <c>MedicalTool.UseOther(BaseEntity.RPCMessage)</c> .
        /// </summary>
        public static void On_PlayerSyringeOther(MedicalTool medicalTool, BaseEntity.RPCMessage msg)
        {
            BasePlayer messagePlayer = msg.player;

            if (messagePlayer.CanInteract() == false)
                return;

            if ((bool)medicalTool.CallMethod("HasItemAmount") == false || medicalTool.canUseOnOther == false)
                return;

            BasePlayer owner = medicalTool.GetOwnerPlayer();

            if (owner == null)
                return;

            BasePlayer target = BaseNetworkable.serverEntities.Find(msg.read.UInt32()) as BasePlayer;

            if (target != null && Vector3.Distance(target.transform.position, owner.transform.position) < 4f) {
                var preSyringeUseEvent = new Pre<SyringeUseEvent>(medicalTool, owner, target);
                
                OnNext("Pre_PlayerSyringeOther", preSyringeUseEvent);

                if (preSyringeUseEvent.IsCanceled == false) {
                    medicalTool.ClientRPCPlayer(null, messagePlayer, "Reset");
                    medicalTool.CallMethod("GiveEffectsTo", target);
                    medicalTool.CallMethod("UseItemAmount", 1);

                    OnNext("On_PlayerSyringeOther", preSyringeUseEvent.Event);
                }
            }
        }
示例#7
0
        /// <summary>
        /// Called from <c>MedicalTool.UseSelf(BaseEntity.RPCMessage)</c> .
        /// </summary>
        public static void On_PlayerSyringeSelf(MedicalTool medicalTool, BaseEntity.RPCMessage msg)
        {
            BasePlayer messagePlayer = msg.player;

            if (messagePlayer.CanInteract() == false)
                return;

            if ((bool)medicalTool.CallMethod("HasItemAmount") == false)
                return;

            BasePlayer owner = medicalTool.GetOwnerPlayer();

            var preSyringeUseEvent = new Pre<SyringeUseEvent>(medicalTool, owner, owner);

            OnNext("Pre_PlayerSyringeSelf", preSyringeUseEvent);

            if (preSyringeUseEvent.IsCanceled == false) {
                medicalTool.ClientRPCPlayer(null, messagePlayer, "Reset");
                medicalTool.CallMethod("GiveEffectsTo", owner);
                medicalTool.CallMethod("UseItemAmount", 1);

                OnNext("On_PlayerSyringeSelf", preSyringeUseEvent.Event);
            }
        }
示例#8
0
 public SyringeUseEvent(MedicalTool syringe, BasePlayer owner, BasePlayer target)
 {
     Syringe = syringe;
     User = Server.GetPlayer(owner);
     Receiver = Server.GetPlayer(target);
 }