Jump to content

[MODS] patterns and etc


Recommended Posts

Hello guys. In this topic, I'll just share, perhaps useful templates for programmers.

1. Basic Spawn Minion

Spoiler

void SpawnMinion(Vector3 pos)
{
  GameObject gameObject = Util.KInstantiate(Assets.GetPrefab((Tag)MinionConfig.ID), (GameObject)null, (string)null);
  gameObject.name = Assets.GetPrefab((Tag)MinionConfig.ID).name;
  Immigration.Instance.ApplyDefaultPersonalPriorities(gameObject);
  gameObject.transform.SetLocalPosition(pos);
  gameObject.SetActive(true);
  new MinionStartingStats(false).Apply(gameObject);
}

 

2. Basic Create Element 

Spoiler

//CreateElement(pos, SimHashes.ChlorineGas, CellEventLogger.Instance.OxygenModifierSimUpdate);
void CreateElement(Vector3 vector, SimHashes simHashes, CellAddRemoveSubstanceEvent ev)
{
  var element = new ElementConverter.OutputElement(5.0f, simHashes, 343.15f, false, 0.0f, 1f, false, 1f, byte.MaxValue, 0);
  var cell = Grid.PosToCell(vector);
  SimUtil.DiseaseInfo diseaseInfo = SimUtil.DiseaseInfo.Invalid;
  SimUtil.DiseaseInfo a2 = diseaseInfo;
  a2 = SimUtil.CalculateFinalDiseaseInfo(a2, new SimUtil.DiseaseInfo()
                                         {
                                           idx = element.addedDiseaseIdx,
                                           count = element.addedDiseaseCount
                                         });
  SimMessages.AddRemoveSubstance(cell, element.elementHash, ev, 5, element.outputTemperature, a2.idx, a2.count, true, -1);
}

 

What do you think about it? Should I continue? If so, do not hesitate to share, too)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...