Exemplo n.º 1
0
 public static void Prefix(
     AbstractActor __instance,
     DeathMethod deathMethod,
     DamageType damageType,
     int stackItemID,
     string attackerID)
 {
     try
     {
         var actor = __instance;
         if (actor._flaggedForDeath)
         {
             return;
         }
         var pilot = actor.GetPilot();
         if (pilot == null || pilot.IsIncapacitated)
         {
             return;
         }
         // check for any pilot kill leftovers (the pilot was flagged but not yet incapacitated)
         if (deathMethod is not(DeathMethod.CockpitDestroyed or DeathMethod.HeadDestruction or DeathMethod.PilotKilled))
         {
             return;
         }
         // essentially copied from Mech.ApplyHeadStructureEffects
         pilot.LethalInjurePilot(actor.Combat.Constants, attackerID, stackItemID, true, damageType, null, actor.Combat.FindActorByGUID(attackerID));
         actor.GetPilot()?.ShowInjuryMessage(Strings.T("PILOT: LETHAL DAMAGE!"));
     }
     catch (Exception e)
     {
         Control.Logger.Error.Log(e);
     }
 }
		public void Init()
		{
			species = Data.Species[0];
			deadCohorts = new List<ICohort>();

			bool[,] grid = new bool[,]{ {true} };
			DataGrid<bool> dataGrid = new DataGrid<bool>(grid);
			ILandscape landscape = new Landscape.Landscape(dataGrid);
			activeSite = landscape[1,1];

			originalDiedMethod = Cohort.Died;
			Cohort.Died = MyCohortDiedMethod;
		}
Exemplo n.º 3
0
    /// <summary>
    /// This can be called with KillFeed.ReportMurder(GameObject, DeathMode)
    /// This will set all variables for the coroutine to actually update the UI/HUD with the correct kill feed report
    /// </summary>
    /// <param name="Killer">The gameObject who killed the other player</param>
    /// <param name="method">The method of killing the player used against the other player</param>
    public static void ReportMurder(PhotonPlayer Killer, DeathMethod method)
    {
        bool isYou = Killer != PhotonNetwork.player; //"killer" is player who got killed

        killer = isYou ? "You" : Killer.nickname;
        action = method.ToString();
        target = !isYou ? "You" : Killer.nickname;

        //this would be modified to however you store your weapon logic. This is how I store mine
        instrument = Killer.GetComponent <WeaponManager>().weapon.icon;

        //NOTE: You can take this logic and modify it in a way to only use 1 UI Text and death method, to create
        //funny scenarios such as games like Fortnite "Player spantaniously combusted", "Player got absolutely rekt", etc
    }
Exemplo n.º 4
0
        public TaleNewsPawnDied(Pawn victim, DamageInfo?dinfo) : base(victim, InstigationInfo.NoInstigator)
        {
            // DesynchronizedMain.LogError("Dumping stacktrace: " + Environment.StackTrace);

            methodOfDeath = DeathMethod.NON_EXECUTION;

            if (dinfo.HasValue)
            {
                DamageInfo dinfoUnpacked = dinfo.Value;
                killingBlowDamageType = dinfoUnpacked.Def;
                if (dinfoUnpacked.Instigator is Pawn instigator)
                {
                    InstigationDetails = (InstigationInfo)instigator;
                }
            }
        }
Exemplo n.º 5
0
        public void Init()
        {
            species     = Data.Species[0];
            deadCohorts = new List <ICohort>();

            bool[,] grid = new bool[, ] {
                { true }
            };
            DataGrid <bool> dataGrid  = new DataGrid <bool>(grid);
            ILandscape      landscape = new Landscape.Landscape(dataGrid);

            activeSite = landscape[1, 1];

            originalDiedMethod = Cohort.Died;
            Cohort.Died        = MyCohortDiedMethod;
        }
        static bool Prefix(TurretRepresentation __instance, DeathMethod deathMethod)
        {
            // We're a linked turret, replace the kill floatie with a custom one.
            if (ModState.KillingLinkedUnitsSource != null)
            {
                if (__instance.parentActor.WasDespawned)
                {
                    return(false);
                }

                string         localText = new Text(Mod.Config.LocalizedText[ModConfig.FT_Turret_Death], new object[] { __instance.parentActor.DisplayName }).ToString();
                FloatieMessage message   = new FloatieMessage(__instance.parentCombatant.GUID, __instance.parentCombatant.GUID, localText, FloatieMessage.MessageNature.Death);
                __instance.parentCombatant.Combat.MessageCenter.PublishMessage(message);

                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 7
0
 private TaleNewsPawnDied(Pawn victim, DeathMethod method, object argument) : base(victim, InstigatorInfo.NoInstigator)
 {
     methodOfDeath = method;
     if (methodOfDeath == DeathMethod.NON_EXECUTION)
     {
         DeathCause     = argument as DamageInfo?;
         InstigatorInfo = (InstigatorInfo)Killer;
     }
     else
     {
         DeathBrutality?temp = argument as DeathBrutality?;
         if (temp.HasValue)
         {
             BrutalityDegree = temp.Value;
         }
         else
         {
             BrutalityDegree = DeathBrutality.HUMANE;
             Log.Error("[V1024-DESYNC] Cannot recognize \"DeathBrutality\" argument for Pawn execution; did something go wrong?\n" + Environment.StackTrace, true);
         }
     }
 }
        public static bool Prefix(AbstractActor __instance, SerializableReferenceContainer references,
                                  ref bool ___underscoreIsShutDown, bool ____isShutDown,
                                  ref string ___underscoreLanceID, string ____lanceId,
                                  ref string ___underscoreSpawnerID, string ____spawnerId,
                                  ref string ___underscoreTeamID, string ____teamId,
                                  ref bool ___serializableHasHandledDeath,
                                  ref int ___serializableDeathLocation, int ____deathLocation,
                                  ref DeathMethod ___serializableDeathMethod, DeathMethod ____deathMethod,
                                  Team ____team, List <Weapon> ___weapons
                                  )
        {
            //SkillBasedInit.Logger.Log($"AbstractActor:Dehydrate - preventing native call to allow serialization of initiative");

            ___underscoreIsShutDown        = ____isShutDown;
            ___underscoreLanceID           = ____lanceId;
            ___underscoreSpawnerID         = ____spawnerId;
            ___underscoreTeamID            = ____teamId;
            ___serializableHasHandledDeath = __instance.HasHandledDeath;
            ___serializableDeathLocation   = ____deathLocation;
            ___serializableDeathMethod     = ____deathMethod;
            references.AddItem <Team>(__instance, "_team", ____team);
            if (__instance.BehaviorTree != null)
            {
                __instance.BehaviorTree.Dehydrate(references);
            }
            references.AddItemList <Weapon>(__instance, "Weapons", ___weapons);
            references.AddItemList <AmmunitionBox>(__instance, "AmmoBox", __instance.ammoBoxes);
            references.AddItemList <Jumpjet>(__instance, "JumpJets", __instance.jumpjets);
            references.AddItem <Weapon>(__instance, "ImaginaryLaser", __instance.ImaginaryLaserWeapon);
            if (!(__instance.Initiative > 0 && __instance.Initiative < (Mod.MaxPhase + 1)))
            {
                Mod.Log.Info(string.Format("Saving an AbstractActor of type {0} with an invalid initiative of {1}", __instance.ClassName, __instance.Initiative));
            }

            return(false);
        }
Exemplo n.º 9
0
 public TaleNewsPawnDied(Pawn victim, DeathBrutality brutality) : base(victim, InstigationInfo.NoInstigator)
 {
     methodOfDeath = DeathMethod.EXECUTION;
 }
Exemplo n.º 10
0
 protected override void DiscardNewsDetails()
 {
     base.DiscardNewsDetails();
     methodOfDeath         = DeathMethod.INDETERMINATE;
     killingBlowDamageType = null;
 }
Exemplo n.º 11
0
        public static bool Prefix(AbstractActor __instance, SerializableReferenceContainer references, CombatGameState loadedState,
                                  ref bool ____isShutDown, bool ___underscoreIsShutDown,
                                  ref string ____lanceId, string ___underscoreLanceID,
                                  ref string ____spawnerId, string ___underscoreSpawnerID,
                                  ref string ____teamId, string ___underscoreTeamID,
                                  ref Team ____team,
                                  ref Lance ____lance,
                                  ref bool ____hasHandledDeath, bool ___serializableHasHandledDeath,
                                  ref int ____deathLocation, int ___serializableDeathLocation,
                                  ref DeathMethod ____deathMethod, DeathMethod ___serializableDeathMethod,
                                  List <Weapon> ___weapons
                                  )
        {
            //SkillBasedInit.Logger.Log($"AbstractActor:Hydrate - preventing native call to allow deserialization of initiative");

            Traverse.Create(__instance).Property("Combat").SetValue(loadedState);

            ____isShutDown      = ___underscoreIsShutDown;
            ____lanceId         = ___underscoreLanceID;
            ____spawnerId       = ___underscoreSpawnerID;
            ____teamId          = ___underscoreTeamID;
            ____team            = references.GetItem <Team>(__instance, "_team");
            ____lance           = ____team.GetLanceByUID(____lanceId);
            ____hasHandledDeath = ___serializableHasHandledDeath;
            ____deathLocation   = ___serializableDeathLocation;
            ____deathMethod     = ___serializableDeathMethod;
            if (__instance.BehaviorTree != null)
            {
                __instance.BehaviorTree.Hydrate(loadedState, references);
            }
            ___weapons = references.GetItemList <Weapon>(__instance, "Weapons");
            foreach (Weapon weapon in __instance.Weapons)
            {
                weapon.Hydrate(references);
                __instance.allComponents.Add(weapon);
            }
            __instance.ammoBoxes = references.GetItemList <AmmunitionBox>(__instance, "AmmoBox");
            foreach (AmmunitionBox ammunitionBox in __instance.ammoBoxes)
            {
                ammunitionBox.Hydrate(references);
                __instance.allComponents.Add(ammunitionBox);
            }
            __instance.jumpjets = references.GetItemList <Jumpjet>(__instance, "JumpJets");
            foreach (Jumpjet jumpjet in __instance.jumpjets)
            {
                jumpjet.Hydrate(references);
                __instance.allComponents.Add(jumpjet);
            }
            __instance.ImaginaryLaserWeapon = references.GetItem <Weapon>(__instance, "ImaginaryLaser");
            if (__instance.ImaginaryLaserWeapon != null)
            {
                __instance.ImaginaryLaserWeapon.Hydrate(references);
            }
            if (__instance.CustomHeraldryDef != null)
            {
                Traverse requestResources = Traverse.Create(__instance).Method("RequestResources", new Type[] { typeof(DataManager), typeof(Action) });
                requestResources.GetValue(new object[] { loadedState.DataManager, true });
            }

            // OriginalLogic: Initiative > 0 && Initiative < 6;
            if (!(__instance.Initiative > 0 && __instance.Initiative <= Mod.MaxPhase))
            {
                Mod.Log.Info(string.Format("Loading an AbstractActor of type {0} with an invalid initiative of {1}, Reverting to BaseInitiative", __instance.ClassName, __instance.Initiative));
                __instance.Initiative = 1;
            }

            return(false);
        }