public void readFromNbt(NbtCompound tag) { if (tag.hasKey("risingItemId")) { this.risingItem = new RisingItem( this.reg.getElement(tag.getInt("risingItemId")), tag.getFloat("risingCurveLength")); this.risingItem.timer = tag.getFloat("risingTimer"); } }
public static Vector2 getVector2(this NbtCompound tag, string name, Vector2?defaultValue = null) { if (defaultValue == null) { defaultValue = Vector2.zero; } NbtCompound compound = tag.getCompound(name); return(new Vector2( compound.getFloat("x", ((Vector2)defaultValue).x), compound.getFloat("y", ((Vector2)defaultValue).y))); }
public static Quaternion getQuaternion(this NbtCompound tag, string name, Quaternion?defaultValue = null) { if (defaultValue == null) { defaultValue = Quaternion.identity; } NbtCompound compound = tag.getCompound(name); return(new Quaternion( compound.getFloat("w", ((Quaternion)defaultValue).w), compound.getFloat("x", ((Quaternion)defaultValue).x), compound.getFloat("y", ((Quaternion)defaultValue).y), compound.getFloat("z", ((Quaternion)defaultValue).z))); }
public override void readFromNbt(NbtCompound tag) { base.readFromNbt(tag); this.time = tag.getFloat("produceTime"); this.heldResources = tag.getInt("heldResources"); }
public override void readFromNbt(NbtCompound tag) { base.readFromNbt(tag); this.harvestCooldown = tag.getFloat("cooldown"); this.target = this.unit.map.findMapObjectFromGuid <HarvestableObject>(tag.getGuid("target")); }
public override void readFromNbt(NbtCompound tag) { base.readFromNbt(tag); this.constructing = tag.getBool("isBuilding"); this.buildProgress = tag.getFloat("progress"); this.targetRotation = tag.getInt("targetRotation"); }
public override void readFromNbt(NbtCompound tag) { base.readFromNbt(tag); this.energy.value = tag.getFloat("energy"); this.hunger.value = tag.getFloat("hunger"); this.temperature.value = tag.getFloat("temperature"); this.happiness.value = tag.getFloat("happiness"); this.isDead = tag.getBool("isDead"); this.info = new WorkerInfo(tag.getCompound("workerInfo")); this.setType(Main.instance.workerTypeRegistry.getElement(tag.getInt("workerType"))); // Read Ai Meta objects from NBT foreach (IAiMeta meta in this.GetComponentsInChildren <IAiMeta>()) { meta.readFromNbt(tag); } }
public void readFromNbt(NbtCompound tag) { NbtList tagList = tag.getList("entries"); foreach (NbtCompound compound in tagList) { this.entires.Add(new Entry(compound)); } this.isPrimary = tag.getBool("isPrimary"); this.constructionTime = tag.getFloat("constructionTime"); }
public override void readFromNbt(NbtCompound tag) { base.readFromNbt(tag); this.trainingProgress = tag.getFloat("trainingProgress"); NbtList list = tag.getList("trainingQueue"); foreach (NbtInt integer in list) { this.trainingQueue.Add(Registry.getObjectFromRegistry(integer.Value)); } }
public override void readFromNbt(NbtCompound tag) { base.readFromNbt(tag); this.timeWhacking = tag.getFloat("timeWhacking"); this.whackPoint = tag.getVector3("whackPoint"); this.moveHelper.setDestination(this.whackPoint); BuildingBase b = this.unit.map.findMapObjectFromGuid <BuildingBase>(tag.getGuid("building")); if (b != null) { this.setBuilding(b); } }
public UnitStats(NbtCompound tag, UnitData unitData) : this() { this.unitData = unitData; NbtCompound tag1 = tag.getCompound("stats"); this.firstName = tag1.getString("firstName"); this.lastName = tag1.getString("lastName"); this.gender = tag1.getByte("gender") == 1 ? EnumGender.MALE : EnumGender.FEMALE; this.distanceWalked.readFromNbt(tag1); this.timeAlive.readFromNbt(tag1); this.unitsKilled.readFromNbt(tag1); this.buildingsDestroyed.readFromNbt(tag1); this.damageDelt.readFromNbt(tag1); this.damageTaken.readFromNbt(tag1); this.resourcesCollected.readFromNbt(tag1); this.buildingsBuilt.readFromNbt(tag1); this.repairsDone.readFromNbt(tag1); this.hunger = tag1.getFloat("hunger", 1f); this.sleep = tag1.getFloat("sleep", 1f); }
public override void readFromNbt(NbtCompound tag) { base.readFromNbt(tag); this.lastPos = tag.getVector3("lastPos"); this.unitStats = new UnitStats(tag, this.getData()); bool flag = tag.getBool("hasMovementOverride"); if (flag) { this.overrideMovementDestination = tag.getVector3("overrideMovementDestination"); this.overrideMovementStopDis = tag.getFloat("overrideMovementStopDis"); } }
public void readFromNbt(NbtCompound tag) { NbtList list = tag.getList("candidates"); for (int i = 0; i < list.Count; i++) { this.candidates.Add(new Candidate(list.Get <NbtCompound>(i))); } if (tag.hasKey("trainee")) { this.trainee = new Trainee(tag.getCompound("trainee")); this.traineeTrainingTime = tag.getFloat("trainingTime"); } }
public override void readFromNbt(NbtCompound tag) { base.readFromNbt(tag); this.fireCooldown = tag.getFloat("fireCooldown"); MapObject obj = this.map.findMapObjectFromGuid <MapObject>(tag.getGuid("targetGuid")); if (obj is UnitBase) { this.target = (UnitBase)obj; } else { this.target = null; } }
public override void readFromNbt(NbtCompound tag) { base.readFromNbt(tag); this.lastPos = tag.getVector3("lastPos"); this.unitStats = new UnitStats(tag, this.unitData); bool flag = tag.getBool("hasMovementOverride"); if (flag) { this.overrideMovementDestination = tag.getVector3("overrideMovementDestination"); this.overrideMovementStopDis = tag.getFloat("overrideMovementStopDis"); this.moveHelper.setDestination((Vector3)this.overrideMovementDestination, this.overrideMovementStopDis); } NbtCompound tagTask = tag.getCompound("task"); ITask task = (ITask)Activator.CreateInstance(TaskManager.getTaskFromId(tagTask.getInt("taskID")), new object[] { (UnitBase)this }); task.readFromNbt(tagTask); this.setTask(task, true); }
public override void readFromNbt(NbtCompound tag) { base.readFromNbt(tag); this.timeRemaining = tag.getFloat("fireTime"); }
public override void readFromNbt(NbtCompound tag) { base.readFromNbt(tag); this.transferTimer = tag.getFloat("transferTimer"); }
public override void readFromNbt(NbtCompound tag) { base.readFromNbt(tag); this.time = tag.getFloat("produceTime"); }
public void readFromNbt(NbtCompound tag) { this.pullTimer = tag.getFloat("conveyorPullTimer"); }
public override void readFromNbt(NbtCompound tag) { this.value = tag.getFloat(this.saveName); }