public void Samples() { Readability.IsHighlyUnderrated(); What.VersusHow(); Nuke.UnusedCode(); PatienceAnd.Scouting(); }
public override void Execute(IrcMessage message, string args) { //look for next highest ID int maxid = 0; foreach (Nuke needle in State.NukeList.GetItems()) { if (args == needle.Text) { message.ReplyAuto("A nuke already exists on that term."); return; } if (needle.ID > maxid) maxid = needle.ID; } maxid++; //create new Nuke Nuke Nuke = new Nuke(); Nuke.Created = DateTime.UtcNow; Nuke.SetBy = message.From; Nuke.Text = args; Nuke.ID = maxid; //add to collection State.NukeList.Add(Nuke); //reply string text = ControlCharacter.Enabled ? Nuke.Text : ControlCharacter.Strip(Nuke.Text); message.ReplyAuto(message.From + " added Nuke " + ControlCharacter.Bold() + "#" + Nuke.ID.ToString() + ControlCharacter.Bold() + ": " + text); }
public static void AddNuke(Nuke nuke) { OkayegTeaTimeContext database = new(); database.Nukes.Add(nuke); database.SaveChanges(); }
private bool _IsExpired(Nuke nuke, IReceived <Civilian, PublicMessage> message) { var punishmentTimestamp = message.Timestamp <= nuke.Timestamp ? nuke.Timestamp : message.Timestamp; var expirationDate = punishmentTimestamp + nuke.Duration; return(expirationDate < _timeService.UtcNow); }
/// <summary> /// Server-side only. For use when a player has only joined (as a JoinedViewer) and /// is not in control of any mobs. Spawns the player with the specified occupation / settings /// and transfers the viewer to control the new player. /// </summary> /// <param name="forViewer">viewer who should control the player</param> /// <param name="occupation">occupation to spawn as</param> /// <param name="characterSettings">settings to use for the character</param> /// <returns></returns> public static void ServerSpawnPlayer(JoinedViewer forViewer, Occupation occupation, CharacterSettings characterSettings) { NetworkConnection conn = forViewer.connectionToClient; var newPlayer = ServerSpawnInternal(conn, occupation, characterSettings, null); if (newPlayer) { if (occupation.JobType == JobType.SYNDICATE) { //Check to see if there is a nuke and communicate the nuke code: Nuke nuke = Object.FindObjectOfType <Nuke>(); if (nuke != null) { UpdateChatMessage.Send(newPlayer, ChatChannel.Syndicate, ChatModifier.None, "We have intercepted the code for the nuclear weapon: " + nuke.NukeCode); } } GameManager.Instance.CheckAntags(); if (occupation.JobType != JobType.SYNDICATE && occupation.JobType != JobType.AI) { SecurityRecordsManager.Instance.AddRecord(newPlayer.GetComponent <PlayerScript>(), occupation.JobType); } } }
public void Clear() { if (cooldown) { return; } Nuke.Clear(); CodeDisplay.SetValue = ""; }
public static bool collision(Nuke nuke, Terrain terrain, out Vector2 collisionPoint) { bool collision = false; if (CollisionUtils.doPixelsIntersect(nuke.TextureColourData, nuke.Matrix, terrain.TextureColourData, terrain.Matrix, out collisionPoint)) { collision = true; } return(collision); }
public IReadOnlyList <ISendable <ITransmittable> > Create(Nuke nuke, IReadOnlyList <IReceived <IUser, ITransmittable> > context) { _repository.Command(r => r.InMemory.Add(nuke)); var msDelay = Math.Min(_settings.NukeMaximumLinger.TotalMilliseconds, nuke.Duration.TotalMilliseconds); Task.Delay(TimeSpan.FromMilliseconds(msDelay)).ContinueWith(_ => { _repository.Command(r => r.InMemory.Remove(nuke)); }); return(GetCurrentVictims(nuke, context).Select(u => new SendableMute(u, nuke.Duration)).ToList()); }
void addNuke(GameObject origin, GameObject destination, int originID) { GameObject newNuke = (GameObject)Instantiate(Resources.Load("Nuke")); Nuke newNukeControl = newNuke.GetComponent <Nuke>(); newNukeControl.setRoute(origin, destination); newNuke.transform.position = origin.transform.position; newNukeControl.setOrigin(originID); nukes.Add(newNuke); }
public static bool collision(Nuke nuke, Launcher launcher, out Vector2 collisionPoint) { bool collision = false; collisionPoint = new Vector2(-1f); if (CollisionUtils.doPixelsIntersect(nuke.TextureColourData, nuke.Matrix, launcher.TextureColourData, launcher.Matrix, out collisionPoint)) { collision = true; } return(collision); }
private void Awake() { playerHealth.Initialize(); playerShield.Initialize(); rb2d = gameObject.GetComponent <Rigidbody2D>(); sprite = gameObject.GetComponent <SpriteRenderer>(); anim = gameObject.GetComponent <Animator>(); source = GetComponent <AudioSource>(); nuke = GameObject.Find("Nuke").GetComponent <Nuke>(); weaponUnlock = 0; undamaged = true; }
/// <summary> /// Special set up instructions when spawning as a special role /// </summary> void CheckForSpecialRoleTypes() { if (playerScript.mind.jobType == JobType.SYNDICATE) { //Check to see if there is a nuke and communicate the nuke code: Nuke nuke = FindObjectOfType <Nuke>(); if (nuke != null) { UpdateChatMessage.Send(gameObject, ChatChannel.Syndicate, "We have intercepted the code for the nuclear weapon: " + nuke.NukeCode); } } }
public void reset(bool setState = true) { if (setState) { StateManager.getInstance().CurrentGameState = StateManager.GameState.Loading; } StateManager.getInstance().WhosTurn = StateManager.Player.One; SFXEngineParams sfxParms = new SFXEngineParams(); sfxParms.Muted = false; this.sfxEngine = new SFXEngine(sfxParms); this.terrain = new Terrain(Content); this.players = new Launcher[4]; this.nuke = new Nuke(Content, this.sfxEngine); NukeDelegate nukeDelegate = null; ClosestTargetDelegate targetDelegate = null; loadDeletagtes(out nukeDelegate, out targetDelegate); PositionGenerator.getInstance().reset(); for (int i = 0; i < this.players.Length; i++) { if (StateManager.getInstance().TypeOfGame == StateManager.GameType.PlayerVsPlayer) { this.players[i] = new Player(Content, this.sfxEngine, PositionGenerator.getInstance().generate(), nukeDelegate, i); } else if (i == 0) { this.players[i] = new Player(Content, this.sfxEngine, PositionGenerator.getInstance().generate(), nukeDelegate, i); } else { this.players[i] = new Enemy(Content, this.sfxEngine, PositionGenerator.getInstance().generate(), nukeDelegate, i, targetDelegate); } } if (StateManager.getInstance().TypeOfGame == StateManager.GameType.PlayerVsComputers) { // now that all parties are setup, find initial targets for (int i = 1; i < this.players.Length; i++) { ((Enemy)this.players[i]).findTarget(); } } this.explosionEmitter = new ExplosionParticleEmitter(Content, new BaseParticle2DEmitterParams()); // sfx this.explosionSFX = LoadingUtils.load <SoundEffect>(Content, "Explosion"); }
protected override void Setup() { //Check to see if there is a nuke and communicate the nuke code: NukeTarget = FindObjectOfType <Nuke>(); if (NukeTarget == null) { Logger.LogWarning("Unable to setup nuke objective, no nuke found in scene!", Category.Antags); } else { UpdateChatMessage.Send(Owner.body.gameObject, ChatChannel.Syndicate, ChatModifier.None, "We have intercepted the code for the nuclear weapon: " + NukeTarget.NukeCode); } }
public void EnterDigit(char digit) { if (cooldown) { return; } if (Nuke.AppendKey(digit)) { int length = Nuke.CurrentCode.Length; //replace older digits with asterisks string newDigit = Nuke.CurrentCode.Substring(length <= 0 ? 0 : length - 1); CodeDisplay.SetValue = newDigit.PadLeft(length, '*'); StartCoroutine(HideCode()); } }
public void TryArm() { if (cooldown) { return; } if (Nuke.Validate()) { InfoDisplay.SetValue = "PREPARE TO DIE"; } else { StartCoroutine(ErrorCooldown()); } }
public override void AfterSpawn(ConnectedPlayer player) { // add any NuclearOperative specific logic here //send the code: //Check to see if there is a nuke and communicate the nuke code: Nuke nuke = FindObjectOfType <Nuke>(); if (nuke != null) { UpdateChatMessage.Send(player.GameObject, ChatChannel.Syndicate, ChatModifier.None, $"We have intercepted the code for the nuclear weapon: <b>{nuke.NukeCode}</b>."); } AntagManager.TryInstallPDAUplink(player, initialTC); }
// add any NuclearOperative specific logic here public override GameObject ServerSpawn(PlayerSpawnRequest spawnRequest) { //spawn as a nuke op regardless of the requested occupation var newPlayer = PlayerSpawn.ServerSpawnPlayer(spawnRequest.JoinedViewer, AntagOccupation, spawnRequest.CharacterSettings); //send the code: //Check to see if there is a nuke and communicate the nuke code: Nuke nuke = Object.FindObjectOfType <Nuke>(); if (nuke != null) { UpdateChatMessage.Send(newPlayer, ChatChannel.Syndicate, ChatModifier.None, "We have intercepted the code for the nuclear weapon: " + nuke.NukeCode); } return(newPlayer); }
public static void Postfix(LoadoutConfigurator __instance) { Debug.Log("Doing postfix."); Traverse traverse = Traverse.Create(__instance); GameObject gameObject = PatcherHelper.nukeObject; if (gameObject) { GameObject toInject = GameObject.Instantiate <GameObject>(gameObject); toInject.name = "Nuke"; // GameObject equipper = toInject.transform.GetChild(1).gameObject; GameObject edgeTransform = toInject.transform.GetChild(0).gameObject; Nuke nuke = gameObject.AddComponent <Nuke>(); nuke.edgeTransform = edgeTransform; nuke.equipper = GameObject.Instantiate(new GameObject()); nuke.equipper.name = "Nuke"; Debug.Log("Nuke added to EqInfo in postfix."); nuke.init(); nuke.missileLauncher.LoadAllMissiles(); toInject.SetActive(false); Debug.Log("Start eq info"); Dictionary <string, EqInfo> unlockedWeaponPrefabs = (Dictionary <string, EqInfo>)traverse.Field("unlockedWeaponPrefabs").GetValue(); Debug.Log("Got eq info."); EqInfo eq = new EqInfo(nuke.equipper, Environment.CurrentDirectory + "\\VTOLVR_ModLoader\\mods\\Nuke\\nukey"); Debug.Log("New eq"); /*eq.eq = nuke.HPEquipper; * Debug.Log("Eq.eq"); * eq.eqObject = nuke.HPEquipper.gameObject; * Debug.Log("Eq.eqObject");*/ unlockedWeaponPrefabs.Add("B61", eq); // Sadly can't prefix a method so shitty shit shit Debug.Log("Add to list."); traverse.Field("unlockedWeaponPrefabs").SetValue(unlockedWeaponPrefabs); Debug.Log("Postfix 200."); } else { Debug.LogError("Nuke not found in AssetBundle."); } }
private void TakeDamage() { towerHealth += -damage; if (towerHealthUi != null) { towerHealthUi.text = towerHealth.ToString(); } if (towerHealthSlider != null) { towerHealthSlider.value = towerHealth; } if (towerHealth <= 0) { Nuke.gameObject.transform.position = gameObject.transform.position; Nuke.Play(); OnDestroyed.Invoke(); } else if (towerHealth <= maxHealth / 2 && halfHealth) { OnHalfHealth.Invoke(); halfHealth = false; } }
public void Add(Nuke nuke) => Nukes.Add(nuke);
public static bool Prefix(int hpIdx, string weaponName, LoadoutConfigurator __instance) { if (weaponName != "Nuke") { Debug.Log("Prefix 69 true"); return(true); } Debug.Log("Prefix 69 false"); GameObject instantiated = PatcherHelper.nukeObject; instantiated.SetActive(true); Nuke nuke = instantiated.AddComponent <Nuke>(); GameObject equipper = new GameObject(); GameObject edgeTransform = instantiated.transform.GetChild(0).gameObject; nuke.edgeTransform = edgeTransform; nuke.equipper = equipper; equipper.SetActive(true); Debug.Log("Nuke added."); nuke.init(); Debug.Log("PH instantiate"); Transform weaponTf = equipper.transform; nuke.missileLauncher.LoadAllMissiles(); Debug.Log("wTf transform"); // Traverse hpTransformsTraverse = Traverse.Create<LoadoutConfigurator>().Field("hpTransforms"); Debug.Log("traverse hpTransforms"); Transform[] transforms = __instance.wm.hardpointTransforms; Debug.Log("get"); Transform hpTf = transforms[hpIdx]; Debug.Log("hpTf = transforms"); InternalWeaponBay iwb = null; Debug.Log("null iwb"); // Traverse iwbAttachTraverse = Traverse.Create<LoadoutConfigurator>().Field("iwbAttach"); MethodInfo dynMethod = __instance.GetType().GetMethod("iwbAttach", BindingFlags.NonPublic | BindingFlags.Instance); Debug.Log("dyn method"); // object iwbAttach = (InternalWeaponBay)dynMethod.Invoke(__instance, null); Debug.Log("iwb attach"); // object iwbAttach = iwbAttachTraverse.GetValue(__instance); /*for (int i = 0; i < __instance.wm.internalWeaponBays.Length; i++) * { * InternalWeaponBay internalWeaponBay = __instance.wm.internalWeaponBays[i]; * if (internalWeaponBay.hardpointIdx == hpIdx) * { * iwb = internalWeaponBay; * iwb.RegisterOpenReq(iwbAttach); * } * }*/ Debug.Log("iterator"); __instance.equips[hpIdx] = weaponTf.GetComponent <HPEquippable>(); Debug.Log("equips weaponTf"); // __instance.equips[hpIdx].OnConfigAttach(__instance); // Debug.Log("__instance,equips onconfigtattach"); weaponTf.rotation = hpTf.rotation; Debug.Log("ROTATIOENATEAITJAOTATATETED"); Vector3 localPos = new Vector3(0f, -4f, 0f); Debug.Log("create localPos"); weaponTf.position = hpTf.TransformPoint(localPos); Debug.Log("Position"); __instance.UpdateNodes(); Debug.Log("Update Nodes"); Vector3 tgt = new Vector3(0f, 0f, 0.5f); Debug.Log("tgt"); if (hpIdx == 0 || iwb) { tgt = Vector3.zero; } Debug.Log("if vector3"); while ((localPos - tgt).sqrMagnitude > 0.01f) { localPos = Vector3.Lerp(localPos, tgt, 5f * Time.deltaTime); weaponTf.position = hpTf.TransformPoint(localPos); } Debug.Log("while"); weaponTf.parent = hpTf; Debug.Log("parent"); weaponTf.localPosition = tgt; Debug.Log("localPosition = tgt"); weaponTf.localRotation = Quaternion.identity; Debug.Log("Quaternion.identity"); __instance.vehicleRb.AddForceAtPosition(Vector3.up * __instance.equipImpulse, __instance.wm.hardpointTransforms[hpIdx].position, ForceMode.Impulse); Debug.Log("ADD FORCE AT POSITION! POGGERS"); /*Traverse hpAudioSourcesTraverse = Traverse.Create<LoadoutConfigurator>().Field("hpAudioSources"); * Debug.Log("hpAudioSourcesTraverse created!"); * AudioSource[] hpAudioSources = (AudioSource[])hpTransformsTraverse.GetValue(__instance);*/ AudioSource audioSource = new GameObject("HPAudio").AddComponent <AudioSource>(); audioSource.transform.parent = __instance.gameObject.transform; audioSource.transform.position = hpTf.position; audioSource.spatialBlend = 1f; audioSource.minDistance = 4f; audioSource.maxDistance = 1000f; audioSource.dopplerLevel = 0f; Debug.Log("hpAudioSources 200"); audioSource.PlayOneShot(__instance.attachAudioClip); Debug.Log("play 1 shot"); __instance.attachPs.transform.position = hpTf.position; Debug.Log("Attach p's transform"); __instance.attachPs.FireBurst(); Debug.Log("FireBurst()"); while (weaponTf.localPosition.sqrMagnitude > 0.001f) { weaponTf.localPosition = Vector3.MoveTowards(weaponTf.localPosition, Vector3.zero, 4f * Time.deltaTime); } Debug.Log("While 2 or 3 i dont remember or give a f**k"); /*if (iwb) * { * iwb.UnregisterOpenReq(iwbAttach); * } * Debug.Log("iwb unregister");*/ weaponTf.localPosition = Vector3.zero; Debug.Log("Vector3.zero"); __instance.UpdateNodes(); Debug.Log("UpdateNodes called, we're all done! Return false time;!!!!!!!!!"); return(false); }
void OnSceneChange(Scene oldScene, Scene newScene) { SyndiNukeCode = Nuke.CodeGenerator(); }
private bool _WithinRange(Nuke nuke, IReceived <Civilian, PublicMessage> message) => message.Timestamp.IsWithin(nuke.Timestamp, _settings.NukeBlastRadius);
public IReadOnlyList <ISendable <ITransmittable> > Nuke(IReadOnlyList <IReceived <IUser, ITransmittable> > context, Nuke nuke) => _nukeMuteFactory.Create(nuke, context);
protected IEnumerable <Civilian> GetCurrentVictims(Nuke nuke, IEnumerable <IReceived <IUser, ITransmittable> > context) => context .OfType <IReceived <Civilian, PublicMessage> >() .Where(m => WillPunish(nuke, m)) .Select(m => m.Sender) .DistinctBy(c => c.Nick);
public void EquipCustomWeapons(Loadout loadout, WeaponManager wm) { triggered = true; Traverse traverse = Traverse.Create(wm); HPEquippable[] equips = (HPEquippable[])traverse.Field("equips").GetValue(); MassUpdater component = wm.vesselRB.GetComponent <MassUpdater>(); string[] hpLoadout = loadout.hpLoadout; int num = 0; Debug.Log("sLoadout\n" + loadout.hpLoadout.ToString()); // var bundle = AssetBundle.LoadFromFile(resourcePath); while (num < wm.hardpointTransforms.Length && num < hpLoadout.Length) { if (!string.IsNullOrEmpty(hpLoadout[num]) && hpLoadout[num] == "Nuke") { Debug.Log(hpLoadout[num] + " will be tried to be loaded."); GameObject missileObject = PatcherHelper.GetAssetBundle().LoadAsset <GameObject>(hpLoadout[num]); Debug.Log("Got missileObject"); //GameObject missileObject = Instantiate(@object, wm.hardpointTransforms[num]); // toCheckAgainst = wm.hardpointTransforms[num]; Debug.Log("Instantiated custom weapon."); missileObject.name = hpLoadout[num]; Debug.Log("Changed name."); missileObject.transform.localRotation = Quaternion.identity; Debug.Log("Quaternion identity."); missileObject.transform.localPosition = Vector3.zero; Debug.Log("local position."); missileObject.transform.localScale = new Vector3(20f, 20f, 20f); Debug.Log("local scale."); if (missileObject == null) { Debug.LogError("missileObject is null."); } // missileLauncher.SetParentRigidbody(rB); GameObject equipper = Instantiate(new GameObject()); GameObject edgeTransform = missileObject.transform.GetChild(0).gameObject; Nuke nuke = missileObject.AddComponent <Nuke>(); nuke.edgeTransform = edgeTransform; nuke.equipper = equipper; equipper.SetActive(true); Debug.Log("Nuke added."); nuke.init(); Debug.Log("Nuke inited."); if (equipper == null) { Debug.LogError("Equipper is null."); } if (equipper.transform.position == null) { Debug.LogError("Equipper transform posiiton null"); } if (wm.hardpointTransforms[num].position == null) { Debug.LogError("wm hardopint transforms position null"); } equipper.transform.position = wm.hardpointTransforms[num].position; Debug.Log("Equipper transform."); equipper.transform.parent = wm.hardpointTransforms[num]; Debug.Log("Equipper transform parent."); HPEquipBombRack HPEquipper = nuke.HPEquipper; Debug.Log("HPEquipper inited."); HPEquipper.SetWeaponManager(wm); Debug.Log("Weapon Manager."); equips[num] = HPEquipper; Debug.Log("equips = component."); HPEquipper.wasPurchased = true; Debug.Log("was purchased."); HPEquipper.hardpointIdx = num; Debug.Log("hardpointIDX."); HPEquipper.Equip(); Debug.Log("Equip()."); Debug.Log("Tipping nuke"); if (HPEquipper.jettisonable) { Rigidbody component3 = HPEquipper.GetComponent <Rigidbody>(); if (component3) { component3.interpolation = RigidbodyInterpolation.None; } } Debug.Log("jettisonable."); if (HPEquipper.armable) { HPEquipper.armed = true; wm.RefreshWeapon(); } Debug.Log("RefrshWeapon()."); missileObject.SetActive(true); foreach (Component component4 in HPEquipper.gameObject.GetComponentsInChildren <Component>()) { if (component4 is IParentRBDependent) { ((IParentRBDependent)component4).SetParentRigidbody(wm.vesselRB); } if (component4 is IRequiresLockingRadar) { ((IRequiresLockingRadar)component4).SetLockingRadar(wm.lockingRadar); } if (component4 is IRequiresOpticalTargeter) { ((IRequiresOpticalTargeter)component4).SetOpticalTargeter(wm.opticalTargeter); } } Debug.Log("DLZ shit"); MissileLauncher missileLauncher = nuke.missileLauncher; if (missileLauncher.missilePrefab == null) { Debug.LogError("MissilePrefab is null"); } if (missileLauncher.missilePrefab.GetComponent <Missile>() == null) { Debug.LogError("Missile not found on prefab"); } if (missileLauncher.hardpoints[0] == null) { Debug.LogError("Hardpoints null"); } missileLauncher.LoadAllMissiles(); Debug.Log(missileLauncher.missiles[0]); Debug.Log("HEY IT WORKED"); Warhead nyuk = missileLauncher.missiles[0].gameObject.AddComponent <Warhead>(); missileLauncher.missiles[0].OnDetonate = new UnityEvent(); missileLauncher.missiles[0].OnDetonate.AddListener(new UnityAction(() => { Debug.Log("Nuke is now critical."); nyuk.DoNuke(); })); missileLauncher.missiles[0].enabled = true; if (missileLauncher.missiles[0].transform == null) { Debug.LogError("Missile[0] null"); } Debug.Log("Nuke should now have teeth"); if (missileLauncher.overrideDecoupleSpeed > 0f) { missileLauncher.missiles[0].decoupleSpeed = missileLauncher.overrideDecoupleSpeed; } if (missileLauncher.overrideDecoupleDirections != null && missileLauncher.overrideDecoupleDirections.Length > 0 && missileLauncher.overrideDecoupleDirections[0] != null) { missileLauncher.missiles[0].overrideDecoupleDirTf = missileLauncher.overrideDecoupleDirections[0]; } if (missileLauncher.overrideDropTime >= 0f) { missileLauncher.missiles[0].thrustDelay = missileLauncher.overrideDropTime; } // int missileCount = missileLauncher.missileCount; /*GameObject dummyMissile = Instantiate(@object, wm.hardpointTransforms[num]); * dummyMissile.transform.localScale = new Vector3(20f, 20f, 20f); * dummyMissile.transform.eulerAngles = new Vector3(dummyMissile.transform.eulerAngles.x, dummyMissile.transform.eulerAngles.y, dummyMissile.transform.eulerAngles.z + 90f); * dummyMissile.SetActive(true);*/ missileLauncher.missiles[0].transform.localScale = new Vector3(20f, 20f, 20f); missileLauncher.missiles[0].transform.parent = equipper.transform; missileLauncher.missiles[0].transform.position = equipper.transform.position; missileLauncher.missiles[0].transform.eulerAngles = new Vector3(missileLauncher.missiles[0].transform.eulerAngles.x, missileLauncher.missiles[0].transform.eulerAngles.y, missileLauncher.missiles[0].transform.eulerAngles.z + 90f); missileLauncher.missiles[0].gameObject.SetActive(true); // Destroy(dummyMissile); Missile.LaunchEvent launchEvent = new Missile.LaunchEvent(); launchEvent.delay = 0f; launchEvent.launchEvent = new UnityEvent(); launchEvent.launchEvent.AddListener(new UnityAction(() => { Debug.Log("Launch event was called."); // dummyMissile.SetActive(false); /*Destroy(dummyMissile); */ })); missileLauncher.missiles[0].launchEvents = new List <Missile.LaunchEvent>(); missileLauncher.missiles[0].launchEvents.Add(launchEvent); toCheck = missileLauncher.missiles[0]; Debug.Log("Missiles loaded!"); } else { Debug.LogError(hpLoadout[num] + " is null or empty."); } num++; } if (wm.vesselRB) { wm.vesselRB.ResetInertiaTensor(); } Debug.Log("intertia tensor."); if (loadout.cmLoadout != null) { CountermeasureManager componentInChildren = GetComponentInChildren <CountermeasureManager>(); if (componentInChildren) { int num2 = 0; while (num2 < componentInChildren.countermeasures.Count && num2 < loadout.cmLoadout.Length) { componentInChildren.countermeasures[num2].count = Mathf.Clamp(loadout.cmLoadout[num2], 0, componentInChildren.countermeasures[num2].maxCount); componentInChildren.countermeasures[num2].UpdateCountText(); num2++; } } } traverse.Field("weaponIdx").SetValue(0); Debug.Log("weaponIDX."); wm.ToggleMasterArmed(); wm.ToggleMasterArmed(); if (wm.OnWeaponChanged != null) { wm.OnWeaponChanged.Invoke(); } component.UpdateMassObjects(); traverse.Field("rcsAddDirty").SetValue(true); // wm.ReattachWeapons(); Debug.Log("Should be working now..."); wm.RefreshWeapon(); foreach (var equip in wm.GetCombinedEquips()) { Debug.Log(equip); } }
public void Remove(Nuke nuke) => Nukes.Remove(nuke);
public void SetPlayerLoadOuts() { JobOutfit standardOutfit = GameManager.Instance.StandardOutfit.GetComponent <JobOutfit>(); JobOutfit jobOutfit = GameManager.Instance.GetOccupationOutfit(playerScript.mind.jobType); Dictionary <EquipSlot, string> gear = new Dictionary <EquipSlot, string>(); gear.Add(EquipSlot.uniform, standardOutfit.uniform); gear.Add(EquipSlot.ear, standardOutfit.ears); gear.Add(EquipSlot.belt, standardOutfit.belt); gear.Add(EquipSlot.back, standardOutfit.backpack); gear.Add(EquipSlot.feet, standardOutfit.shoes); gear.Add(EquipSlot.eyes, standardOutfit.glasses); gear.Add(EquipSlot.hands, standardOutfit.gloves); gear.Add(EquipSlot.exosuit, standardOutfit.suit); gear.Add(EquipSlot.head, standardOutfit.head); //gear.Add(EquipSlot.accessory, standardOutfit.accessory); gear.Add(EquipSlot.mask, standardOutfit.mask); //gear.Add(EquipSlot.backpack, standardOutfit.backpack); //gear.Add(EquipSlot.satchel, standardOutfit.satchel); //gear.Add(EquipSlot.duffelbag, standardOutfit.duffelbag); //gear.Add(EquipSlot.box, standardOutfit.box); //gear.Add(EquipSlot.l_hand, standardOutfit.l_hand); //gear.Add(EquipSlot.l_pocket, standardOutfit.l_pocket); //gear.Add(EquipSlot.r_pocket, standardOutfit.r_pocket); //gear.Add(EquipSlot.suit_store, standardOutfit.suit_store); if (!string.IsNullOrEmpty(jobOutfit.uniform)) { gear[EquipSlot.uniform] = jobOutfit.uniform; } /*if (!String.IsNullOrEmpty(jobOutfit.id)) * gear[EquipSlot.id] = jobOutfit.id;*/ if (!string.IsNullOrEmpty(jobOutfit.ears)) { gear[EquipSlot.ear] = jobOutfit.ears; } if (!string.IsNullOrEmpty(jobOutfit.belt)) { gear[EquipSlot.belt] = jobOutfit.belt; } if (!string.IsNullOrEmpty(jobOutfit.backpack)) { gear[EquipSlot.back] = jobOutfit.backpack; } if (!string.IsNullOrEmpty(jobOutfit.shoes)) { gear[EquipSlot.feet] = jobOutfit.shoes; } if (!string.IsNullOrEmpty(jobOutfit.glasses)) { gear[EquipSlot.eyes] = jobOutfit.glasses; } if (!string.IsNullOrEmpty(jobOutfit.gloves)) { gear[EquipSlot.hands] = jobOutfit.gloves; } if (!string.IsNullOrEmpty(jobOutfit.suit)) { gear[EquipSlot.exosuit] = jobOutfit.suit; } if (!string.IsNullOrEmpty(jobOutfit.head)) { gear[EquipSlot.head] = jobOutfit.head; } /*if (!String.IsNullOrEmpty(jobOutfit.accessory)) * gear[EquipSlot.accessory] = jobOutfit.accessory;*/ if (!string.IsNullOrEmpty(jobOutfit.mask)) { gear[EquipSlot.mask] = jobOutfit.mask; } /*if (!String.IsNullOrEmpty(jobOutfit.backpack)) * gear[EquipSlot.backpack] = jobOutfit.backpack; * if (!String.IsNullOrEmpty(jobOutfit.satchel)) * gear[EquipSlot.satchel] = jobOutfit.satchel; * if (!String.IsNullOrEmpty(jobOutfit.duffelbag)) * gear[EquipSlot.duffelbag] = jobOutfit.duffelbag; * if (!String.IsNullOrEmpty(jobOutfit.box)) * gear[EquipSlot.box] = jobOutfit.box; * if (!String.IsNullOrEmpty(jobOutfit.l_hand)) * gear[EquipSlot.l_hand] = jobOutfit.l_hand; * if (!String.IsNullOrEmpty(jobOutfit.l_pocket)) * gear[EquipSlot.l_pocket] = jobOutfit.l_pocket; * if (!String.IsNullOrEmpty(jobOutfit.r_pocket)) * gear[EquipSlot.r_pocket] = jobOutfit.r_pocket; * if (!String.IsNullOrEmpty(jobOutfit.suit_store)) * gear[EquipSlot.suit_store] = jobOutfit.suit_store;*/ foreach (KeyValuePair <EquipSlot, string> gearItem in gear) { if (gearItem.Value.Contains(UniItemUtils.ClothingHierIdentifier) || gearItem.Value.Contains(UniItemUtils.HeadsetHierIdentifier) || gearItem.Value.Contains(UniItemUtils.BackPackHierIdentifier) || gearItem.Value.Contains(UniItemUtils.BagHierIdentifier)) { GameObject obj = ClothFactory.CreateCloth(gearItem.Value, TransformState.HiddenPos, transform.parent); //if ClothFactory does not return an object then move on to the next clothing item if (!obj) { Logger.LogWarning("Trying to instantiate clothing item " + gearItem.Value + " failed!", Category.Equipment); continue; } ItemAttributes itemAtts = obj.GetComponent <ItemAttributes>(); SetItem(gearItem.Key, itemAtts.gameObject); } else if (!string.IsNullOrEmpty(gearItem.Value)) { // Logger.Log(gearItem.Value + " creation not implemented yet."); } } SpawnID(jobOutfit); if (playerScript.mind.jobType == JobType.SYNDICATE) { //Check to see if there is a nuke and communicate the nuke code: Nuke nuke = FindObjectOfType <Nuke>(); if (nuke != null) { UpdateChatMessage.Send(gameObject, ChatChannel.Syndicate, "We have intercepted the code for the nuclear weapon: " + nuke.NukeCode); } } }
private bool WillPunish(Nuke nuke, IReceived <Civilian, PublicMessage> message) => nuke.MatchesNukedTerm(message.Transmission.Text) && _WithinRange(nuke, message) && !_IsExpired(nuke, message);