Skip to content

Commit 5380b49

Browse files
committed
Added a custom model and a new sprite for the black powder
1 parent ee072e8 commit 5380b49

File tree

3 files changed

+8
-78
lines changed

3 files changed

+8
-78
lines changed
3.04 KB
Binary file not shown.

AlterraWeaponry/behaviours/TorpedoExplosionBehaviour.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class TorpedoExplosionBehaviour : MonoBehaviour
1111
public void Start()
1212
{
1313
DamageSystem.RadiusDamage(250f, base.gameObject.transform.position, 5f, DamageType.Explosive, base.gameObject);
14-
Utils.PlayOneShotPS(VFXSunbeam.main.explosionPrefab, base.gameObject.transform.position, base.gameObject.transform.rotation, null);
14+
Utils.PlayOneShotPS(new VFXMeteor().impactPrefab, base.gameObject.transform.position, base.gameObject.transform.rotation, null);
1515
UnityEngine.Object.Destroy(base.gameObject);
1616
}
1717

AlterraWeaponry/items/BlackPowder.cs

Lines changed: 7 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ namespace VELD.AlterraWeaponry.items;
1010

1111
internal class BlackPowder : Craftable
1212
{
13-
public static GameObject prefab = Main.assets.LoadAsset<GameObject>("GameObject.BlackPowder");
13+
public static GameObject AssetPrefab = Main.assets.LoadAsset<GameObject>("GameObject.BlackPowder");
14+
public static GameObject prefab;
1415
public static TechType techType { get; private set; } = 0;
1516

1617
public BlackPowder() : base("BlackPowder", "BlackPowder", "Tooltip_BlackPowder")
@@ -55,90 +56,19 @@ public override GameObject GetGameObject()
5556
PrefabIdentifier prefabIdentifier = prefab.AddComponent<PrefabIdentifier>();
5657
prefabIdentifier.ClassId = base.ClassID;
5758
prefabIdentifier.name = base.ClassID;
58-
Rigidbody rigidbody = prefab.AddComponent<Rigidbody>();
59-
rigidbody.useGravity = false;
60-
rigidbody.mass = 1f;
6159
prefab.AddComponent<WorldForces>();
62-
LargeWorldEntity largeWorldEntity = prefab.AddComponent<LargeWorldEntity>();
60+
prefab.AddComponent<LargeWorldEntity>();
6361
TechTag techTag = prefab.AddComponent<TechTag>();
6462
techTag.type = base.TechType;
65-
Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>();
66-
Shader shader = Shader.Find("MarmosetUBER");
67-
for(int i = 0; i < componentsInChildren.Length; i++)
68-
{
69-
for(int ind = 0; ind < componentsInChildren[i].materials.Length; ind++)
70-
{
71-
Material material = componentsInChildren[i].materials[ind];
72-
Texture texture = material.GetTexture("_SpecGlossMap");
73-
Texture texture2 = material.GetTexture("_EmissionMap");
74-
material.shader = shader;
75-
material.DisableKeyword("_SPECGLOSSMAP");
76-
material.DisableKeyword("_NORMALMAP");
77-
bool flag2 = texture != null;
78-
if (flag2)
79-
{
80-
material.SetTexture("_SpecTex", texture);
81-
material.SetFloat("_SpecInt", 1f);
82-
material.SetFloat("_Shininess", 4f);
83-
material.EnableKeyword("MARMO_SPECMAP");
84-
material.SetColor("_SpecColor", new(1f, 1f, 1f, 1f));
85-
material.SetFloat("_Fresnel", 0.24f);
86-
material.SetVector("_SpecTex_ST", new(1f, 1f, 0f, 0f));
87-
}
88-
bool flag3 = material.IsKeywordEnabled("_EMMISSION");
89-
if(flag3)
90-
{
91-
material.EnableKeyword("MARMO_EMISSION");
92-
material.SetFloat("_EnableGlow", 1f);
93-
material.SetTexture("_Illum", texture2);
94-
material.SetFloat("_GlowStrenght", 1f);
95-
material.SetFloat("_GlowStrengthNight", 1f);
96-
}
97-
bool flag4 = material.GetTexture("_BumpMap");
98-
if(flag4)
99-
{
100-
material.EnableKeyword("MARMO_NORMALMAP");
101-
}
102-
bool flag5 = material.name.ToLower().Contains("cutout");
103-
if(flag5)
104-
{
105-
material.EnableKeyword("MARMO_ALPHA_CLIP");
106-
}
107-
bool flag6 = material.name.ToLower().Contains("transparent");
108-
if(flag6)
109-
{
110-
material.EnableKeyword("_ZWRITE_ON");
111-
material.EnableKeyword("WBOIT");
112-
material.SetInt("_ZWrite", 0);
113-
material.SetInt("_Cutoff", 0);
114-
material.SetFloat("_SrcBlend", 1f);
115-
material.SetFloat("_DstBlend", 1f);
116-
material.SetFloat("_SrcBlend2", 0f);
117-
material.SetFloat("_DstBlend2", 10f);
118-
material.SetFloat("_AddSrcBlend", 1f);
119-
material.SetFloat("_AddDstBlend", 1f);
120-
material.SetFloat("_AddSrcBlend2", 0f);
121-
material.SetFloat("_AddDstBlend2", 10f);
122-
material.globalIlluminationFlags = (MaterialGlobalIlluminationFlags.RealtimeEmissive | MaterialGlobalIlluminationFlags.EmissiveIsBlack);
123-
material.renderQueue = 3101;
124-
material.enableInstancing = true;
125-
}
126-
}
127-
}
128-
prefab.SetActive(true);
12963
}
64+
prefab.SetActive(true);
13065
GameObject go = UnityEngine.Object.Instantiate<GameObject>(prefab);
131-
//go.transform.GetChild(0).localPosition = new(0, 0, 0);
132-
//go.transform.GetChild(0).localEulerAngles = new(-90f, 0, 0);
13366
return go;
13467
}
13568
public override IEnumerator GetGameObjectAsync(IOut<GameObject> gameObject)
13669
{
137-
CoroutineTask<GameObject> task = CraftData.GetPrefabForTechTypeAsync(TechType.Sulphur);
138-
yield return task;
139-
GameObject go = GameObject.Instantiate(task.GetResult());
140-
141-
// Don't forget to change to custom prefab or try to get the alternative prefab as fast as possible.
142-
gameObject.Set(go);
70+
gameObject.Set(this.GetGameObject());
71+
yield return null;
72+
yield break;
14373
}
14474
}

0 commit comments

Comments
 (0)