void PasteDeployables(List <object> deployablesData, Vector3 targetPoint, float targetRot, float heightAdjustment, NetUser player) { Vector3 OriginRotation = new Vector3(0f, targetRot, 0f); Quaternion OriginRot = Quaternion.EulerRotation(OriginRotation); foreach (Dictionary <string, object> deployable in deployablesData) { Dictionary <string, object> structPos = deployable["pos"] as Dictionary <string, object>; Dictionary <string, object> structRot = deployable["rot"] as Dictionary <string, object>; string prefabname = (string)deployable["prefabname"]; Quaternion newAngles = Quaternion.EulerRotation((new Vector3(Convert.ToSingle(structRot["x"]), Convert.ToSingle(structRot["y"]), Convert.ToSingle(structRot["z"]))) + OriginRotation); Vector3 TempPos = OriginRot * (new Vector3(Convert.ToSingle(structPos["x"]), Convert.ToSingle(structPos["y"]), Convert.ToSingle(structPos["z"]))); Vector3 NewPos = TempPos + targetPoint; DeployableObject block = SpawnDeployable(prefabname, NewPos, newAngles); if (block != null) { block.SetupCreator(player.playerClient.controllable); block.GrabCarrier(); LootableObject lootobject = block.GetComponent <LootableObject>(); if (lootobject == null) { continue; } List <object> itemlist = deployable["items"] as List <object>; if (itemlist == null || itemlist.Count == 0) { continue; } foreach (Dictionary <string, object> item in itemlist) { lootobject._inventory.AddItemAmount(displaynameToDataBlock[item["name"].ToString()], (displaynameToDataBlock[item["name"].ToString()])._splittable? Convert.ToInt32(item["amount"]) : 1); } } } }
public void NewObject() { DeployableObject = NetCull.InstantiateStatic(";deploy_wood_box", origin + h, character.rotation).GetComponent <DeployableObject>(); DeployableObject.SetupCreator(character.controllable); }
void NewObject() { lastObject = NetCull.InstantiateStatic(";deploy_wood_box", nextForward + heightAdjusment, character.rotation).GetComponent <DeployableObject>(); lastObject.SetupCreator(character.controllable); }
void NewObject() { lastObject = NetCull.InstantiateStatic(";deploy_wood_box", nextForward + heightAdjusment, character.rotation).GetComponent<DeployableObject>(); lastObject.SetupCreator(character.controllable); }