public void setState(string setState) { if (setState != this.state) { this.state = setState; } this.items = InteractionInterface.getCrateItems(int.Parse(base.transform.parent.name), Sneaky.expose(this.state)); if (Interact.edit == base.gameObject) { //HUDInteract.crate(int.Parse(base.transform.parent.name), this.items); } }
public void destroyBarricade(Vector3 position) { int indexFromPositionServer; ClientItem[,] crateItems; Point2 region = NetworkRegions.getRegion(position); bool flag = false; int item = -1; Vector3 vector3 = Vector3.zero; if (Network.isServer) { indexFromPositionServer = SpawnBarricades.getIndexFromPositionServer(region, position); if (SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id == 16019 || SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id == 16025 || SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id == 16023) { if (SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id != 16019) { string[] strArrays = Packer.unpack(SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].state, '\u005F'); crateItems = InteractionInterface.getCrateItems(SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id, Sneaky.expose(strArrays[2])); } else { crateItems = InteractionInterface.getCrateItems(SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id, Sneaky.expose(SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].state)); } for (int i = 0; i < 2; i++) { for (int j = 0; j < BarricadeStats.getCapacity(SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id); j++) { if (!ItemStackable.getStackable(crateItems[i, j].id)) { SpawnItems.drop(crateItems[i, j].id, crateItems[i, j].amount, crateItems[i, j].state, position); } else { for (int k = 0; k < crateItems[i, j].amount; k++) { SpawnItems.drop(crateItems[i, j].id, 1, crateItems[i, j].state, position); } } } } } else if (ExplosiveStats.getDamage(SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id) != 0) { flag = true; item = SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id; if (SpawnBarricades.regions[region.x, region.y].barricades[indexFromPositionServer].id != 16015) { vector3 = position + Vector3.up; NetworkEffects.askEffect("Effects/grenade", position, Quaternion.Euler(-90f, 0f, 0f), -1f); NetworkSounds.askSoundMax("Sounds/Projectiles/grenade", position, 1f, UnityEngine.Random.Range(0.95f, 1.05f), 4f, 64f); } else { vector3 = position + SpawnBarricades.regions[region.x, region.y].models[indexFromPositionServer].transform.up; NetworkEffects.askEffect("Effects/bomb", position, Quaternion.Euler(-90f, 0f, 0f), -1f); NetworkSounds.askSoundMax("Sounds/Projectiles/bomb", position, 1f, UnityEngine.Random.Range(0.95f, 1.05f), 4f, 64f); } } if (indexFromPositionServer != -1 && indexFromPositionServer < SpawnBarricades.regions[region.x, region.y].barricades.Count) { SpawnBarricades.regions[region.x, region.y].barricades.RemoveAt(indexFromPositionServer); } } indexFromPositionServer = SpawnBarricades.getIndexFromPositionClient(region, position); if (indexFromPositionServer != -1 && indexFromPositionServer < SpawnBarricades.regions[region.x, region.y].models.Count) { UnityEngine.Object.Destroy(SpawnBarricades.regions[region.x, region.y].models[indexFromPositionServer]); SpawnBarricades.regions[region.x, region.y].models.RemoveAt(indexFromPositionServer); } if (flag) { ExplosionTool.explode(vector3, (float)ExplosiveStats.getRange(item), ExplosiveStats.getDamage(item)); } }