protected ModPrefab_Fragment( string techTypeName, string friendlyName, TechType template, EntitySlot.Type slotType, bool prefabZUp, LargeWorldEntity.CellLevel cellLevel, Vector3 localScale, float scanTime = 2, int totalFragments = 2, bool destroyAfterScan = true ) : base(techTypeName, $"{techTypeName}_Prefab") { TechTypeName = techTypeName; FriendlyName = friendlyName; FragmentTemplate = template; SlotType = slotType; PrefabZUp = prefabZUp; CellLevel = cellLevel; LocalScale = localScale; ScanTime = scanTime; TotalFragments = totalFragments; DestroyAfterScan = destroyAfterScan; }
public static List <EntitySlot.Type> ConvertSlotTypes(EntitySlotData.EntitySlotType entitySlotType) { List <EntitySlot.Type> slotsTypes = new List <EntitySlot.Type>(); foreach (KeyValuePair <EntitySlotData.EntitySlotType, EntitySlot.Type> mapping in typeMapping) { EntitySlotData.EntitySlotType slotType = mapping.Key; EntitySlot.Type type = mapping.Value; if ((entitySlotType & slotType) == slotType) { slotsTypes.Add(type); } } return(slotsTypes); }
/// <summary> /// Adds in a custom <see cref="WorldEntityInfo"/> to the <see cref="WorldEntityDatabase"/> of the game. /// It contains information about the entity, like its <see cref="LargeWorldEntity.CellLevel"/>, its <see cref="EntitySlotData.EntitySlotType"/>, etc. /// </summary> /// <param name="classId">The classId of the entity.</param> /// <param name="techType">The <see cref="TechType"/> of the entity.</param> /// <param name="prefabZUp">Whether the prefab's Z-axis should be facing up, when spawned.</param> /// <param name="cellLevel">The <see cref="LargeWorldEntity.CellLevel"/> of the entity.</param> /// <param name="slotType">The <see cref="EntitySlot.Type"/> of the entity. Dictates which "slots" are suitable for this entity to spawn in. For e.g., most in-crate fragments have a <see cref="EntitySlot.Type.Small"/> slot type.</param> /// <param name="localScale">The scale that the entity's local scale is set to when spawned.</param> public static void AddCustomInfo(string classId, TechType techType, Vector3 localScale, bool prefabZUp = false, LargeWorldEntity.CellLevel cellLevel = LargeWorldEntity.CellLevel.Global, EntitySlot.Type slotType = EntitySlot.Type.Small) { Main.AddCustomInfo(classId, new WorldEntityInfo() { classId = classId, techType = techType, cellLevel = cellLevel, slotType = slotType, localScale = localScale, prefabZUp = prefabZUp }); }