Esempio n. 1
0
        static bool Prefix(Item __instance, Collider other)
        {
            //Debug.Log("OnTriggerEnter " + __instance.m_type + " server =" + Overload.NetworkManager.IsServer() + " index=" + __instance.m_index);
            if (__instance.m_type != ItemType.KEY_SECURITY || !CTF.IsActive)
            {
                return(true);
            }
            if (other.attachedRigidbody == null)
            {
                return(false);
            }
            PlayerShip component = other.attachedRigidbody.GetComponent <PlayerShip>();

            if (component == null)
            {
                return(false);
            }
            Player c_player = component.c_player;

            if (!(bool)ItemIsReachable.Invoke(__instance, new object[] { other }) || (bool)component.m_dying)
            {
                return(false);
            }
            if (Overload.NetworkManager.IsServer() && !NetworkMatch.m_postgame && !c_player.c_player_ship.m_dying)
            {
                if (!CTF.Pickup(c_player, __instance.m_index))
                {
                    return(false);
                }
                c_player.CallRpcPlayItemPickupFX(__instance.m_type, __instance.m_super);
                UnityEngine.Object.Destroy(__instance.c_go);
            }
            return(false);
        }
Esempio n. 2
0
File: CTF.cs Progetto: derhass/olmod
        static bool Prefix(Item __instance, Collider other)
        {
            if (__instance.m_type == ItemType.NONE)
            {
                return(false);
            }

            if (__instance.m_type != ItemType.KEY_SECURITY || !CTF.IsActive)
            {
                return(true);
            }

            if (other.attachedRigidbody == null)
            {
                return(false);
            }

            PlayerShip component = other.attachedRigidbody.GetComponent <PlayerShip>();

            if (component == null)
            {
                return(false);
            }

            Player c_player = component.c_player;

            if (!(bool)_Item_ItemIsReachable_Method.Invoke(__instance, new object[] { other }) || (bool)component.m_dying)
            {
                return(false);
            }

            if (Overload.NetworkManager.IsServer() && !NetworkMatch.m_postgame && !c_player.c_player_ship.m_dying)
            {
                if (!CTF.Pickup(c_player, __instance))
                {
                    return(false);
                }
                c_player.CallRpcPlayItemPickupFX(__instance.m_type, __instance.m_super);
            }
            return(false);
        }