private void Awake() { if (this.material == null) { this.material = (Material)UnityEngine.Object.Instantiate(Bundling.Load("rust/fpgrass/grassmaterial", typeof(Material))); } }
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 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 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); }
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); }
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 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 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); } }
private void Update() { if (!base.dead) { float radExposureScalar; float num2; float num3; float num4; if (this.radiation != null) { num4 = this.radiation.CalculateExposure(true); num3 = this.radiation.CalculateExposure(false); radExposureScalar = this.radiation.GetRadExposureScalar(num4); num2 = this.radiation.GetRadExposureScalar(num3); } else { radExposureScalar = 0f; num2 = 0f; num4 = 0f; num3 = 0f; } ImageEffectManager.GetInstance <NoiseAndGrain>().intensityMultiplier = 10f * radExposureScalar; if (geiger0 == null) { Bundling.Load <AudioClip>("content/item/sfx/geiger_low", out geiger0); Bundling.Load <AudioClip>("content/item/sfx/geiger_medium", out geiger1); Bundling.Load <AudioClip>("content/item/sfx/geiger_high", out geiger2); Bundling.Load <AudioClip>("content/item/sfx/geiger_ultra", out geiger3); } if (num3 >= 0.02f) { if (geigerSoundPlayer == null) { System.Type[] components = new System.Type[] { typeof(AudioSource) }; geigerSoundPlayer = new GameObject("GEIGER SOUNDS", components); geigerSoundPlayer.transform.position = base.transform.position; geigerSoundPlayer.transform.parent = base.transform; geigerSoundPlayer.audio.loop = true; } AudioClip clip = null; if (num2 <= 0.25f) { clip = geiger0; } else if (num2 <= 0.5f) { clip = geiger1; } else if (num2 <= 0.75f) { clip = geiger2; } else { clip = geiger3; } if (clip != geigerSoundPlayer.audio.clip) { geigerSoundPlayer.audio.Stop(); geigerSoundPlayer.audio.clip = clip; geigerSoundPlayer.audio.Play(); } } else if (geigerSoundPlayer != null) { geigerSoundPlayer.audio.Stop(); UnityEngine.Object.Destroy(geigerSoundPlayer); geigerSoundPlayer = null; } } }
public static NGCConfiguration Load() { return(Bundling.Load <NGCConfiguration>("content/network/NGCConf")); }
private void Update() { float radExposureScalar; float single; float single1; float single2; if (base.dead) { return; } if (!this.radiation) { radExposureScalar = 0f; single = 0f; single2 = 0f; single1 = 0f; } else { single2 = this.radiation.CalculateExposure(true); single1 = this.radiation.CalculateExposure(false); radExposureScalar = this.radiation.GetRadExposureScalar(single2); single = this.radiation.GetRadExposureScalar(single1); } ImageEffectManager.GetInstance <NoiseAndGrain>().intensityMultiplier = 10f * radExposureScalar; if (LocalRadiationEffect.geiger0 == null) { Bundling.Load <AudioClip>("content/item/sfx/geiger_low", out LocalRadiationEffect.geiger0); Bundling.Load <AudioClip>("content/item/sfx/geiger_medium", out LocalRadiationEffect.geiger1); Bundling.Load <AudioClip>("content/item/sfx/geiger_high", out LocalRadiationEffect.geiger2); Bundling.Load <AudioClip>("content/item/sfx/geiger_ultra", out LocalRadiationEffect.geiger3); } if (single1 >= 0.02f) { if (!LocalRadiationEffect.geigerSoundPlayer) { LocalRadiationEffect.geigerSoundPlayer = new GameObject("GEIGER SOUNDS", new Type[] { typeof(AudioSource) }); LocalRadiationEffect.geigerSoundPlayer.transform.position = base.transform.position; LocalRadiationEffect.geigerSoundPlayer.transform.parent = base.transform; LocalRadiationEffect.geigerSoundPlayer.audio.loop = true; } AudioClip audioClip = null; if (single <= 0.25f) { audioClip = LocalRadiationEffect.geiger0; } else if (single > 0.5f) { audioClip = (single > 0.75f ? LocalRadiationEffect.geiger3 : LocalRadiationEffect.geiger2); } else { audioClip = LocalRadiationEffect.geiger1; } if (audioClip != LocalRadiationEffect.geigerSoundPlayer.audio.clip) { LocalRadiationEffect.geigerSoundPlayer.audio.Stop(); LocalRadiationEffect.geigerSoundPlayer.audio.clip = audioClip; LocalRadiationEffect.geigerSoundPlayer.audio.Play(); } } else if (LocalRadiationEffect.geigerSoundPlayer) { LocalRadiationEffect.geigerSoundPlayer.audio.Stop(); UnityEngine.Object.Destroy(LocalRadiationEffect.geigerSoundPlayer); LocalRadiationEffect.geigerSoundPlayer = null; } }
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); }