public static void Initialize() { DatablockDictionary._dataBlocks = new Dictionary <string, int>(); DatablockDictionary._dataBlocksByUniqueID = new Dictionary <int, int>(); DatablockDictionary._lootSpawnLists = new Dictionary <string, LootSpawnList>(); List <ItemDataBlock> itemDataBlocks = new List <ItemDataBlock>(); HashSet <ItemDataBlock> itemDataBlocks1 = new HashSet <ItemDataBlock>(); ItemDataBlock[] itemDataBlockArray = Bundling.LoadAll <ItemDataBlock>(); for (int i = 0; i < (int)itemDataBlockArray.Length; i++) { ItemDataBlock itemDataBlock = itemDataBlockArray[i]; if (itemDataBlocks1.Add(itemDataBlock)) { int count = itemDataBlocks.Count; DatablockDictionary._dataBlocks.Add(itemDataBlock.name, count); DatablockDictionary._dataBlocksByUniqueID.Add(itemDataBlock.uniqueID, count); itemDataBlocks.Add(itemDataBlock); } } DatablockDictionary._all = itemDataBlocks.ToArray(); LootSpawnList[] lootSpawnListArray = Bundling.LoadAll <LootSpawnList>(); for (int j = 0; j < (int)lootSpawnListArray.Length; j++) { LootSpawnList lootSpawnList = lootSpawnListArray[j]; DatablockDictionary._lootSpawnLists.Add(lootSpawnList.name, lootSpawnList); } DatablockDictionary.initializedAtLeastOnce = true; }
public void BundleTenant() { while (true) { List <string> lst = new List <string> { "All" }; var ten = Data.GetAppCodes(); lst.AddRange(ten); string modCode = GetSelectionFromUser("Select Module", lst.ToArray()); if (modCode == null) { break; } if (modCode == "All") { foreach (var b in ten) { Bundling.ProductionPack(b); } } else { Bundling.ProductionPack(modCode); } } }
private bool DoReassignmentOfTerrainData(bool td, bool andFlush, bool mats, bool doNotCopySettings) { if (!this.terrainDataFromBundle && !Bundling.Load <TerrainData>(this.bundlePathToTerrainData, out this.terrainDataFromBundle)) { Debug.LogError(string.Concat("Bad terrain data path ", this.bundlePathToTerrainData)); return(true); } if (td) { if (!doNotCopySettings) { this.terrain.terrainData = this.terrainDataFromBundle; this.RestoreTerrainSettings(); } else { this.terrain.terrainData = this.terrainDataFromBundle; } } if (mats) { this.terrain.materialTemplate = this._terrainMaterialTemplate; } if (andFlush) { this.terrain.Flush(); if (mats) { this.terrain.materialTemplate = this._terrainMaterialTemplate; } } return(!this.terrainDataFromBundle); }
public static void Initialize() { _dataBlocks = new Dictionary <string, int>(); _dataBlocksByUniqueID = new Dictionary <int, int>(); _lootSpawnLists = new Dictionary <string, LootSpawnList>(); System.Collections.Generic.List <ItemDataBlock> list = new System.Collections.Generic.List <ItemDataBlock>(); HashSet <ItemDataBlock> set = new HashSet <ItemDataBlock>(); foreach (ItemDataBlock block in Bundling.LoadAll <ItemDataBlock>()) { if (set.Add(block)) { int count = list.Count; _dataBlocks.Add(block.name, count); _dataBlocksByUniqueID.Add(block.uniqueID, count); list.Add(block); } } _all = list.ToArray(); foreach (LootSpawnList list2 in Bundling.LoadAll <LootSpawnList>()) { _lootSpawnLists.Add(list2.name, list2); } initializedAtLeastOnce = true; }
private void Awake() { if (this.material == null) { this.material = (Material)UnityEngine.Object.Instantiate(Bundling.Load("rust/fpgrass/grassmaterial", typeof(Material))); } }
public void LoadConfig() { if (!File.Exists(Path.Combine(ModuleFolder, "Config.ini"))) { File.Create(Path.Combine(ModuleFolder, "Config.ini")).Dispose(); config = new IniParser(Path.Combine(ModuleFolder, "Config.ini")); config.Save(); foreach (ItemDataBlock item in Bundling.LoadAll <ItemDataBlock>()) { if (itemList.ItemList.Contains(item.name)) { config.AddSetting("Config", item.name + ":" + item.uniqueID.ToString(), item._maxUses.ToString()); } } config.Save(); } config = new IniParser(Path.Combine(ModuleFolder, "Config.ini")); foreach (string itemid in config.EnumSection("Config")) { int id = int.Parse(itemid.Split(':')[1]); int amount = int.Parse(config.GetSetting("Config", itemid)); _stackSizes.Add(id, amount); DatablockDictionary.GetByUniqueID(id)._maxUses = amount; } }
public StructureMaster CreateSM(Fougerite.Player p, float x, float y, float z, Quaternion rot) { StructureMaster master = NetCull.InstantiateClassic <StructureMaster>(Bundling.Load <StructureMaster>("content/structures/StructureMasterPrefab"), new Vector3(x, y, z), rot, 0); master.SetupCreator(p.PlayerClient.controllable); return(master); }
public void UploadBundle() { while (true) { var envs = paths.GetEnvironments(); string envName = GetSelectionFromUser("Select environment ", envs.Select(d => d.Name).ToArray()); if (envName == null) { break; } Injector.GetService <EnvironmentAccessor>().CurrentEnvironment = envs.Where(d => d.Name == envName).First(); while (true) { var ten = Data.GetAppCodes(); string modCode = GetSelectionFromUser("Select Module", ten); if (modCode == null) { break; } string version = Bundling.GetAppVersion(modCode); Publisher.UploadTenantBundle(modCode, "v" + version); var changeVersion = GetBoolFromUser("Apply version change on server ", true); if (changeVersion) { Publisher.SetTenantInfo(modCode, version); } } } }
public Texture GetIconTexture() { if (!this.iconTex && !Bundling.Load <Texture>(this.icon, out this.iconTex)) { Bundling.Load <Texture>("content/item/tex/unknown", out this.iconTex); } return(this.iconTex); }
public static bool LoadIconOrUnknownForced <TTex>(string iconPath, out TTex tex) where TTex : Texture { if (!Bundling.Load <TTex>(iconPath, out tex)) { return(Bundling.Load <TTex>("content/item/tex/unknown", out tex)); } return(true); }
public void Vomit() { if (Metabolism.vomitSound == null) { Bundling.Load <AudioClip>("content/shared/sfx/vomit", out Metabolism.vomitSound); } Metabolism.vomitSound.Play(1f); }
public void Vomit() { if (vomitSound == null) { Bundling.Load <AudioClip>("content/shared/sfx/vomit", out vomitSound); } vomitSound.Play((float)1f); }
protected virtual void PlayHitNotification(Vector3 point, Character shooterOrNull) { if (WeaponDataBlock._hitNotify || Bundling.Load <AudioClip>("content/shared/sfx/hitnotification", out WeaponDataBlock._hitNotify)) { WeaponDataBlock._hitNotify.PlayLocal(Camera.main.transform, Vector3.zero, 1f, 1); } if (WeaponDataBlock._hitIndicator || Bundling.Load <HUDHitIndicator>("content/hud/HUDHitIndicator", out WeaponDataBlock._hitIndicator)) { HUDHitIndicator.CreateIndicator(point, (!shooterOrNull ? true : !shooterOrNull.stateFlags.aim), WeaponDataBlock._hitIndicator); } }
protected virtual void PlayHitNotification(Vector3 point, Character shooterOrNull) { if ((WeaponDataBlock._hitNotify != null) || Bundling.Load <AudioClip>("content/shared/sfx/hitnotification", out WeaponDataBlock._hitNotify)) { WeaponDataBlock._hitNotify.PlayLocal(Camera.main.transform, Vector3.zero, 1f, 1); } if ((_hitIndicator != null) || Bundling.Load <HUDHitIndicator>("content/hud/HUDHitIndicator", out _hitIndicator)) { bool followPoint = true; HUDHitIndicator.CreateIndicator(point, followPoint, _hitIndicator); } }
public void Initialize() { if ((this.probabilityTexture == null) && (this.gridSize > 0)) { this.CreateRenderTexture(); } if (this.material == null) { this.material = (Material)UnityEngine.Object.Instantiate(Bundling.Load("rust/fpgrass/RenderSplatMaterial", typeof(Material))); this.material.SetTexture("_Noise", (Texture2D)Bundling.Load("rust/fpgrass/noise", typeof(Texture2D))); } }
public static SurfaceInfoObject GetDefault() { if (_default == null) { Bundling.Load <SurfaceInfoObject>("rust/effects/impact/default", out _default); if (_default == null) { Debug.Log("COULD NOT GET DEFAULT!"); } } return(_default); }
private void Start() { if (!RPOSInventoryCell._myMaterial) { Bundling.Load <Material>("content/item/mat/ItemIconShader", out RPOSInventoryCell._myMaterial); } this._icon.enabled = false; if ((int)this.modSprites.Length > 0) { this.mod_empty = this.modSprites[0].atlas.GetSprite("slot_empty"); this.mod_full = this.modSprites[0].atlas.GetSprite("slot_full"); } }
private static void BleedDir(Vector3 startPos, Vector3 dir, int hitMask) { RaycastHit raycastHit; Ray ray = new Ray(startPos + (dir * 0.25f), dir); if (Physics.Raycast(ray, out raycastHit, 4f, hitMask)) { if (BloodHelper.bloodDecalPrefab == null && !Bundling.Load <GameObject>("content/effect/BloodDecal", out BloodHelper.bloodDecalPrefab)) { return; } Quaternion quaternion = Quaternion.LookRotation(raycastHit.normal); GameObject gameObject = UnityEngine.Object.Instantiate(BloodHelper.bloodDecalPrefab, raycastHit.point + (raycastHit.normal * UnityEngine.Random.Range(0.025f, 0.035f)), quaternion * Quaternion.Euler(0f, 0f, (float)UnityEngine.Random.Range(0, 360))) as GameObject; UnityEngine.Object.Destroy(gameObject, 12f); } }
private static void OnResourcesLoaded() { BaseTraitMap[] baseTraitMapArray = Bundling.LoadAll <BaseTraitMap>(); for (int i = 0; i < (int)baseTraitMapArray.Length; i++) { BaseTraitMap baseTraitMap = baseTraitMapArray[i]; if (baseTraitMap) { try { Binder.BindMap(baseTraitMap); } catch (Exception exception) { UnityEngine.Debug.LogError(exception, baseTraitMap); } } } DatablockDictionary.Initialize(); NetMainPrefab[] netMainPrefabArray = Bundling.LoadAll <NetMainPrefab>(); for (int j = 0; j < (int)netMainPrefabArray.Length; j++) { NetMainPrefab netMainPrefab = netMainPrefabArray[j]; try { netMainPrefab.Register(true); } catch (Exception exception1) { UnityEngine.Debug.LogException(exception1, netMainPrefab); } } uLinkNetworkView[] uLinkNetworkViewArray = Bundling.LoadAll <uLinkNetworkView>(); for (int k = 0; k < (int)uLinkNetworkViewArray.Length; k++) { uLinkNetworkView _uLinkNetworkView = uLinkNetworkViewArray[k]; try { NetCull.RegisterNetAutoPrefab(_uLinkNetworkView); } catch (Exception exception2) { UnityEngine.Debug.LogException(exception2, _uLinkNetworkView); } } NGC.Register(NGCConfiguration.Load()); }
public static void AllBlueprints() { PlayerInventory component = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>().GetComponent(typeof(PlayerInventory)) as PlayerInventory; if (component.dirtySlotCount != 0) { System.Collections.Generic.List <BlueprintDataBlock> boundBPs = component.GetBoundBPs(); foreach (BlueprintDataBlock block in Bundling.LoadAll <BlueprintDataBlock>()) { if (!boundBPs.Contains(block)) { Notice.Inventory(" ", block.name); boundBPs.Add(block); } } } }
private void ReassignTerrainData() { if (Application.isPlaying && !terrain.manual) { if (!Bundling.Load <TerrainData>(this.bundlePathToTerrainData, out this.terrainDataFromBundle)) { Debug.LogError(string.Concat("Bad terrain data path ", this.bundlePathToTerrainData)); } try { this.terrain.terrainData = this.terrainDataFromBundle; this.RestoreTerrainSettings(); } catch (Exception exception) { Debug.Log(exception, this); base.Invoke("ReassignTerrainData", this.reassignTerrainDataInterval); } } }
public void AutoWood() { if (CVars.Misc.AutoWood) { Character component = PlayerClient.GetLocalPlayer().controllable.GetComponent <Character>(); Inventory inventory = component.GetComponent(typeof(Inventory)) as Inventory; MeleeWeaponItem <MeleeWeaponDataBlock> item = inventory._activeItem as MeleeWeaponItem <MeleeWeaponDataBlock>; if (((inventory._activeItem is MeleeWeaponItem <MeleeWeaponDataBlock>) && ((Time.time - this.LAST_ATTACK_TIME) > item.datablock.fireRate)) && this.AUTO_WOOD_GATHER) { RaycastHit2 hit; this.LAST_ATTACK_TIME = Time.time; ItemRepresentation itemRepresentation = item.itemRepresentation; IMeleeWeaponItem iface = item.iface as IMeleeWeaponItem; bool flag = Physics2.Raycast2(component.eyesRay, out hit, item.datablock.range, 0x183e1411); Vector3 point = hit.point; itemRepresentation.Action(3, uLink.RPCMode.Server); uLink.BitStream stream = new uLink.BitStream(false); if (flag) { HUDHitIndicator indicator; IDMain idMain = hit.idMain; stream.WriteBoolean(true); stream.Write <NetEntityID>(NetEntityID.Get((UnityEngine.MonoBehaviour)idMain), new object[0]); stream.WriteVector3(point); stream.WriteBoolean(false); itemRepresentation.ActionStream(1, uLink.RPCMode.Server, stream); if (Bundling.Load <HUDHitIndicator>("content/hud/HUDHitIndicator", out indicator)) { HUDHitIndicator.CreateIndicator(point, true, indicator); } } else { stream.WriteBoolean(false); stream.WriteVector3(Vector3.zero); stream.WriteBoolean(true); itemRepresentation.ActionStream(1, uLink.RPCMode.Server, stream); } } } }
private static void OnResourcesLoaded() { foreach (BaseTraitMap map in Bundling.LoadAll <BaseTraitMap>()) { if (map != null) { try { Binder.BindMap(map); } catch (Exception exception) { Debug.LogError(exception, map); } } } DatablockDictionary.Initialize(); foreach (NetMainPrefab prefab in Bundling.LoadAll <NetMainPrefab>()) { try { prefab.Register(true); } catch (Exception exception2) { Debug.LogException(exception2, prefab); } } foreach (uLinkNetworkView view in Bundling.LoadAll <uLinkNetworkView>()) { try { NetCull.RegisterNetAutoPrefab(view); } catch (Exception exception3) { Debug.LogException(exception3, view); } } NGC.Register(NGCConfiguration.Load()); }
private bool LearnAllBPs() { int count = 0; PlayerInventory playerInventory = Hooks.LocalPlayer.controllable.GetComponent <Character>().GetComponent <PlayerInventory>(); if (playerInventory != null) { List <BlueprintDataBlock> boundBps = playerInventory.GetBoundBPs(); foreach (BlueprintDataBlock blueprintDataBlock in Bundling.LoadAll <BlueprintDataBlock>()) { if (!boundBps.Contains(blueprintDataBlock)) { boundBps.Add(blueprintDataBlock); count++; } } } if (count > 0) { return(true); } return(false); }
public static NGCConfiguration Load() { return(Bundling.Load <NGCConfiguration>("content/network/NGCConf")); }
public void ClientHealthChange(float amount, GameObject attacker) { Vector3 vector3; Character character; float single = base.health; base.AdjustClientSideHealth(amount); float single1 = Mathf.Abs(amount - single); bool flag = amount < single; float single2 = base.healthFraction; if (base.localControlled && single1 >= 1f) { base.GetComponent <LocalDamageDisplay>().SetNewHealthPercent(single2, attacker); } if (attacker && flag && single1 >= 1f && (ClientVitalsSync.hudDamagePrefab || Bundling.Load <HUDDirectionalDamage>("content/hud/DirectionalDamage", out ClientVitalsSync.hudDamagePrefab))) { vector3 = (!IDBase.GetMain <Character>(attacker, out character) ? base.origin - attacker.transform.position : base.eyesOrigin - character.eyesOrigin); HUDDirectionalDamage.CreateIndicator(vector3, (double)amount, NetCull.time, 1.60000002384186, ClientVitalsSync.hudDamagePrefab); } RPOS.HealthUpdate(amount); }
public void ClientHealthChange(float amount, GameObject attacker) { float health = base.health; base.AdjustClientSideHealth(amount); float num2 = amount; float num3 = Mathf.Abs((float)(num2 - health)); bool flag = amount < health; float healthFraction = base.healthFraction; if (base.localControlled && (num3 >= 1f)) { base.GetComponent <LocalDamageDisplay>().SetNewHealthPercent(healthFraction, attacker); } if ((((attacker != null) && flag) && (num3 >= 1f)) && ((hudDamagePrefab != null) || Bundling.Load <HUDDirectionalDamage>("content/hud/DirectionalDamage", out hudDamagePrefab))) { Vector3 vector; Character character; if (IDBase.GetMain <Character>(attacker, out character)) { vector = base.eyesOrigin - character.eyesOrigin; } else { vector = base.origin - attacker.transform.position; } HUDDirectionalDamage.CreateIndicator(vector, (double)amount, NetCull.time, 1.6000000238418579, hudDamagePrefab); } RPOS.HealthUpdate(amount); }
public void Start() { List <GUIContent> Clothing = new List <GUIContent>(); List <GUIContent> Medical = new List <GUIContent>(); List <GUIContent> Weapons = new List <GUIContent>(); List <GUIContent> Construction = new List <GUIContent>(); List <GUIContent> Resource = new List <GUIContent>(); List <GUIContent> Tools = new List <GUIContent>(); List <GUIContent> Misc = new List <GUIContent>(); foreach (ItemDataBlock item in Bundling.LoadAll <ItemDataBlock>()) { if (list.ItemList.Contains(item.name)) { if (list.Clothing.Contains(item.name)) { Clothing.Add(new GUIContent { image = item.GetIconTexture(), text = item.name, tooltip = item.name }); } else if (list.Construction.Contains(item.name)) { Construction.Add(new GUIContent { image = item.GetIconTexture(), text = item.name, tooltip = item.name }); } else if (list.Medical.Contains(item.name)) { Medical.Add(new GUIContent { image = item.GetIconTexture(), text = item.name, tooltip = item.name }); } else if (list.Misc.Contains(item.name)) { Misc.Add(new GUIContent { image = item.GetIconTexture(), text = item.name, tooltip = item.name }); } else if (list.Resources.Contains(item.name)) { Resource.Add(new GUIContent { image = item.GetIconTexture(), text = item.name, tooltip = item.name }); } else if (list.Tools.Contains(item.name)) { Tools.Add(new GUIContent { image = item.GetIconTexture(), text = item.name, tooltip = item.name }); } else if (list.Weapons.Contains(item.name)) { Weapons.Add(new GUIContent { image = item.GetIconTexture(), text = item.name, tooltip = item.name }); } else { continue; } } } ItemTextures_Weapons = Weapons.ToArray(); ItemTextures_Construction = Construction.ToArray(); ItemTextures_Clothing = Clothing.ToArray(); ItemTextures_Medical = Medical.ToArray(); ItemTextures_Resource = Resource.ToArray(); ItemTextures_Misc = Misc.ToArray(); ItemTextures_Tools = Tools.ToArray(); InvokeRepeating("NoClipSetter", 0f, 0.5f); }
private static void BleedDir(Vector3 startPos, Vector3 dir, int hitMask) { RaycastHit hit; Ray ray = new Ray(startPos + ((Vector3)(dir * 0.25f)), dir); if (Physics.Raycast(ray, out hit, 4f, hitMask) && ((bloodDecalPrefab != null) || Bundling.Load <GameObject>("content/effect/BloodDecal", out bloodDecalPrefab))) { Quaternion quaternion = Quaternion.LookRotation(hit.normal); GameObject obj2 = UnityEngine.Object.Instantiate(bloodDecalPrefab, hit.point + ((Vector3)(hit.normal * UnityEngine.Random.Range((float)0.025f, (float)0.035f))), quaternion * Quaternion.Euler(0f, 0f, (float)UnityEngine.Random.Range(0, 360))) as GameObject; UnityEngine.Object.Destroy(obj2, 12f); } }
public void PrepEnvironment() { var packProd = GetBoolFromUser("Pack vendor production ", false); Bundling.PrepEnvironment(packProd); }