コード例 #1
0
        internal static void PressurePlate(int x, int y, global::Terraria.Entity entity)
        {
            if (Hooks.Collision.PressurePlate?.Invoke(ref x, ref y, ref entity) == HookResult.Cancel)
            {
                return;
            }

            //In the patcher the below code is removed so we must action the logic ourselves.
            global::Terraria.Wiring.HitSwitch(x, y);
            global::Terraria.NetMessage.SendData(59, number: x, number2: y);
        }
コード例 #2
0
        /// <summary>
        /// This method is injected into the StrikeNPC method along with an additional variable [cancelResult] which is returned
        /// if this method returns false.
        /// </summary>
        internal static bool Strike
        (
            global::Terraria.NPC npc,
            ref double cancelResult,
            ref int Damage,
            ref float knockBack,
            ref int hitDirection,
            ref bool crit,
            ref bool noEffect,
            ref bool fromNet,
            global::Terraria.Entity entity
        )
        {
            var res = Hooks.Npc.Strike?.Invoke(npc, ref cancelResult, ref Damage, ref knockBack, ref hitDirection, ref crit, ref noEffect, ref fromNet, entity);

            if (res.HasValue)
            {
                return(res.Value == HookResult.Continue);
            }
            return(true);
        }