feat: new looks for the Race Menu Ward, Contract Bank and Bone Servant tables
Recolour and kitbash from vanilla parts, no new assets. PieceLook copies materials before tinting so vanilla pieces keep their colours. ModelBorrow gains activeOnly, which drops hidden snow, fire and broken meshes before a borrowed piece is measured.
This commit is contained in:
parent
cb29f54a28
commit
f3d3c0ebb5
5 changed files with 222 additions and 3 deletions
|
|
@ -36,10 +36,13 @@ namespace RacesOfValheim
|
|||
/// <paramref name="localPosition"/> is where the model's BOTTOM CENTRE goes.
|
||||
/// <paramref name="targetSize"/> is how big its largest dimension should end up, in metres,
|
||||
/// measured AFTER <paramref name="localRotation"/> has been applied.
|
||||
/// <paramref name="activeOnly"/> drops every child the source keeps switched off before measuring.
|
||||
/// A build piece carries its snow cover, its fire, its worn and broken meshes that way, and they
|
||||
/// count towards the size: the cauldron's hidden tripod legs are two metres long.
|
||||
/// </summary>
|
||||
public static GameObject Attach(Transform parent, string holderName, string sourcePrefab,
|
||||
Vector3 localPosition, Quaternion localRotation, float targetSize,
|
||||
string label)
|
||||
string label, bool activeOnly = false)
|
||||
{
|
||||
GameObject source = Jotunn.Managers.PrefabManager.Cache.GetPrefab<GameObject>(sourcePrefab);
|
||||
if (source == null)
|
||||
|
|
@ -52,7 +55,7 @@ namespace RacesOfValheim
|
|||
return empty;
|
||||
}
|
||||
|
||||
return Attach(parent, holderName, source, localPosition, localRotation, targetSize, label);
|
||||
return Attach(parent, holderName, source, localPosition, localRotation, targetSize, label, activeOnly);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -66,7 +69,7 @@ namespace RacesOfValheim
|
|||
/// </summary>
|
||||
public static GameObject Attach(Transform parent, string holderName, GameObject source,
|
||||
Vector3 localPosition, Quaternion localRotation, float targetSize,
|
||||
string label)
|
||||
string label, bool activeOnly = false)
|
||||
{
|
||||
GameObject holder = new GameObject(holderName);
|
||||
holder.transform.SetParent(parent, false);
|
||||
|
|
@ -110,6 +113,16 @@ namespace RacesOfValheim
|
|||
if (nview != null) Object.DestroyImmediate(nview);
|
||||
}
|
||||
|
||||
if (activeOnly)
|
||||
{
|
||||
foreach (Transform child in copy.GetComponentsInChildren<Transform>(true))
|
||||
{
|
||||
// Null once an inactive parent above it has already gone.
|
||||
if (child == null || child == copy.transform || child.gameObject.activeSelf) continue;
|
||||
Object.DestroyImmediate(child.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
FitAndGround(copy.transform, holder.transform, targetSize, sourcePrefab, label);
|
||||
|
||||
holder.SetActive(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue