public static string GetEffect(PhysicMaterial physicMaterial) { switch (AssetNameCache.GetNameLower(physicMaterial)) { case "wood": return("assets/bundled/prefabs/fx/building/wood_gib.prefab"); case "concrete": return("assets/bundled/prefabs/fx/building/stone_gib.prefab"); case "metal": return("assets/bundled/prefabs/fx/building/metal_sheet_gib.prefab"); case "rock": return("assets/bundled/prefabs/fx/building/stone_gib.prefab"); case "flesh": return("assets/bundled/prefabs/fx/building/wood_gib.prefab"); default: return("assets/bundled/prefabs/fx/building/wood_gib.prefab"); } }
public static string GetNameUpper(this Material mat) { return(AssetNameCache.LookupNameUpper((Object)mat)); }
public static string GetNameLower(this PhysicMaterial mat) { return(AssetNameCache.LookupNameLower((Object)mat)); }
public void ServerUse_Strike() { BasePlayer ownerPlayer = GetOwnerPlayer(); if (ownerPlayer == null) { return; } Vector3 position = ownerPlayer.eyes.position; Vector3 vector = ownerPlayer.eyes.BodyForward(); for (int i = 0; i < 2; i++) { List <RaycastHit> obj = Facepunch.Pool.GetList <RaycastHit>(); GamePhysics.TraceAll(new Ray(position - vector * ((i == 0) ? 0f : 0.2f), vector), (i == 0) ? 0f : attackRadius, obj, effectiveRange + 0.2f, 1219701521); bool flag = false; for (int j = 0; j < obj.Count; j++) { RaycastHit hit = obj[j]; BaseEntity entity = RaycastHitEx.GetEntity(hit); if (entity == null || (entity != null && (entity == ownerPlayer || entity.EqualNetID(ownerPlayer))) || (entity != null && entity.isClient) || entity.Categorize() == ownerPlayer.Categorize()) { continue; } float num = 0f; foreach (DamageTypeEntry damageType in damageTypes) { num += damageType.amount; } entity.OnAttacked(new HitInfo(ownerPlayer, entity, DamageType.Slash, num * npcDamageScale)); HitInfo obj2 = Facepunch.Pool.Get <HitInfo>(); obj2.HitEntity = entity; obj2.HitPositionWorld = hit.point; obj2.HitNormalWorld = -vector; if (entity is BaseNpc || entity is BasePlayer) { obj2.HitMaterial = StringPool.Get("Flesh"); } else { obj2.HitMaterial = StringPool.Get((RaycastHitEx.GetCollider(hit).sharedMaterial != null) ? AssetNameCache.GetName(RaycastHitEx.GetCollider(hit).sharedMaterial) : "generic"); } ServerUse_OnHit(obj2); Effect.server.ImpactEffect(obj2); Facepunch.Pool.Free(ref obj2); flag = true; if (!(entity != null) || entity.ShouldBlockProjectiles()) { break; } } Facepunch.Pool.FreeList(ref obj); if (flag) { break; } } }
public static string GetNameUpper(this PhysicMaterial mat) { return(AssetNameCache.LookupNameUpper(mat)); }
public static string GetNameLower(this Material mat) { return(AssetNameCache.LookupNameLower(mat)); }