public static Transform addObject(Vector3 position, Quaternion rotation, Vector3 scale, ushort id, string name, Guid GUID, ELevelObjectPlacementOrigin placementOrigin) { byte b; byte b2; if (Regions.tryGetCoordinate(position, out b, out b2)) { LevelObject levelObject = new LevelObject(position, rotation, scale, id, name, GUID, placementOrigin, LevelObjects.generateUniqueInstanceID()); levelObject.enableCollision(); levelObject.enableVisual(); levelObject.disableSkybox(); LevelObjects.objects[(int)b, (int)b2].Add(levelObject); LevelObjects._total++; return(levelObject.transform); } return(null); }
// Token: 0x060028ED RID: 10477 RVA: 0x000F9B2C File Offset: 0x000F7F2C private static void saveRegion(River river, List <LevelObject> objects) { ushort num = 0; while ((int)num < objects.Count) { LevelObject levelObject = objects[(int)num]; if (levelObject.state != null && levelObject.state.Length > 0) { river.writeUInt16(num); river.writeUInt16(levelObject.id); river.writeBytes(levelObject.state); } num += 1; } river.writeUInt16(ushort.MaxValue); }
// Token: 0x060028E1 RID: 10465 RVA: 0x000F8EDC File Offset: 0x000F72DC public void askObjects(CSteamID steamID, byte x, byte y) { base.channel.openWrite(); base.channel.write(x); base.channel.write(y); ushort num = 0; while ((int)num < LevelObjects.objects[(int)x, (int)y].Count) { LevelObject levelObject = LevelObjects.objects[(int)x, (int)y][(int)num]; if (levelObject.state != null && levelObject.state.Length > 0) { base.channel.write(num); base.channel.write(levelObject.state); } num += 1; } base.channel.write(ushort.MaxValue); base.channel.closeWrite("tellObjects", steamID, ESteamPacket.UPDATE_RELIABLE_CHUNK_BUFFER); }
public static void registerDevkitObject(LevelObject levelObject, out byte x, out byte y) { if (Regions.tryGetCoordinate(levelObject.transform.position, out x, out y)) { LevelObjects.objects[(int)x, (int)y].Add(levelObject); if (LevelObjects.regions[(int)x, (int)y]) { levelObject.enableCollision(); if (!levelObject.isSpeciallyCulled) { levelObject.enableVisual(); } levelObject.disableSkybox(); } else { levelObject.disableCollision(); if (!levelObject.isSpeciallyCulled) { levelObject.disableVisual(); } if (levelObject.isLandmarkQualityMet) { levelObject.enableSkybox(); } } } else { levelObject.enableCollision(); if (!levelObject.isSpeciallyCulled) { levelObject.enableVisual(); } levelObject.disableSkybox(); } }
private void Update() { if (!EditorObjects.isBuilding) { return; } if (GUIUtility.hotControl == 0) { if (EditorInteract.isFlying) { EditorObjects.handleType = EDragType.NONE; if (EditorObjects.isDragging) { EditorObjects._dragStart = Vector2.zero; EditorObjects._dragEnd = Vector2.zero; EditorObjects._isDragging = false; if (EditorObjects.onDragStopped != null) { EditorObjects.onDragStopped(); } EditorObjects.clearSelection(); } return; } if (EditorObjects.handleType != EDragType.NONE) { if (!Input.GetKey(ControlsSettings.primary)) { if (EditorObjects.dragMode == EDragMode.SCALE) { for (int i = 0; i < EditorObjects.selection.Count; i++) { EditorObjects.selection[i].transform.parent = EditorObjects.selection[i].parent; } EditorObjects.group.localScale = Vector3.one; for (int j = 0; j < EditorObjects.selection.Count; j++) { EditorObjects.selection[j].transform.parent = EditorObjects.group; } } EditorObjects.applySelection(); EditorObjects.handleType = EDragType.NONE; } else { if (EditorObjects.handleType == EDragType.TRANSFORM_X) { EditorObjects.transformGroup(EditorObjects.handle.right, EditorObjects.handle.up); } else if (EditorObjects.handleType == EDragType.TRANSFORM_Y) { EditorObjects.transformGroup(EditorObjects.handle.up, EditorObjects.handle.right); } else if (EditorObjects.handleType == EDragType.TRANSFORM_Z) { EditorObjects.transformGroup(EditorObjects.handle.forward, EditorObjects.handle.up); } else if (EditorObjects.handleType == EDragType.PLANE_X) { EditorObjects.planeGroup(EditorObjects.handle.right); } else if (EditorObjects.handleType == EDragType.PLANE_Y) { EditorObjects.planeGroup(EditorObjects.handle.up); } else if (EditorObjects.handleType == EDragType.PLANE_Z) { EditorObjects.planeGroup(EditorObjects.handle.forward); } if (EditorObjects.handleType == EDragType.ROTATION_X) { EditorObjects.rotateGroup(EditorObjects.handle.right, Vector3.right); } else if (EditorObjects.handleType == EDragType.ROTATION_Y) { EditorObjects.rotateGroup(EditorObjects.handle.up, Vector3.up); } else if (EditorObjects.handleType == EDragType.ROTATION_Z) { EditorObjects.rotateGroup(EditorObjects.handle.forward, Vector3.forward); } else if (EditorObjects.handleType == EDragType.SCALE_X) { EditorObjects.scaleGroup(EditorObjects.handle.right, Vector3.right, EditorObjects.handle.localScale.x * EditorObjects.scaleHandle.localScale.x); } else if (EditorObjects.handleType == EDragType.SCALE_Y) { EditorObjects.scaleGroup(EditorObjects.handle.up, Vector3.up, EditorObjects.handle.localScale.x * EditorObjects.scaleHandle.localScale.y); } else if (EditorObjects.handleType == EDragType.SCALE_Z) { EditorObjects.scaleGroup(EditorObjects.handle.forward, Vector3.forward, EditorObjects.handle.localScale.x * EditorObjects.scaleHandle.localScale.z); } else if (EditorObjects.handleType == EDragType.SIZE) { EditorObjects.sizeGroup(EditorObjects.handle.localScale.x); } } } if (Input.GetKeyDown(ControlsSettings.tool_0)) { EditorObjects.dragMode = EDragMode.TRANSFORM; } if (Input.GetKeyDown(ControlsSettings.tool_1)) { EditorObjects.dragMode = EDragMode.ROTATE; } if (Input.GetKeyDown(ControlsSettings.tool_3)) { EditorObjects.dragMode = EDragMode.SCALE; } if ((Input.GetKeyDown(127) || Input.GetKeyDown(8)) && EditorObjects.selection.Count > 0) { LevelObjects.step++; for (int k = 0; k < EditorObjects.selection.Count; k++) { EditorObjects.selection[k].transform.parent = EditorObjects.selection[k].parent; LevelObjects.registerRemoveObject(EditorObjects.selection[k].transform); } EditorObjects.selection.Clear(); EditorObjects.calculateHandleOffsets(); } if (Input.GetKeyDown(122) && Input.GetKey(306)) { EditorObjects.clearSelection(); LevelObjects.undo(); } if (Input.GetKeyDown(120) && Input.GetKey(306)) { EditorObjects.clearSelection(); LevelObjects.redo(); } if (Input.GetKeyDown(98) && EditorObjects.selection.Count > 0 && Input.GetKey(306)) { EditorObjects.copyPosition = EditorObjects.handle.position; EditorObjects.copyRotation = EditorObjects.handle.rotation; if (EditorObjects.selection.Count == 1) { EditorObjects.copyScale = EditorObjects.selection[0].transform.localScale; EditorObjects.copyScale.x = EditorObjects.copyScale.x * EditorObjects.group.localScale.x; EditorObjects.copyScale.y = EditorObjects.copyScale.y * EditorObjects.group.localScale.y; EditorObjects.copyScale.z = EditorObjects.copyScale.z * EditorObjects.group.localScale.z; } else { EditorObjects.copyScale = Vector3.one; } } if (Input.GetKeyDown(110) && EditorObjects.selection.Count > 0 && EditorObjects.copyPosition != Vector3.zero && Input.GetKey(306)) { EditorObjects.pointSelection(); EditorObjects.handle.position = EditorObjects.copyPosition; EditorObjects.handle.rotation = EditorObjects.copyRotation; if (EditorObjects.selection.Count == 1) { EditorObjects.group.localScale = EditorObjects.copyScale; } EditorObjects.updateGroup(); EditorObjects.applySelection(); } if (Input.GetKeyDown(99) && EditorObjects.selection.Count > 0 && Input.GetKey(306)) { EditorObjects.copies.Clear(); for (int l = 0; l < EditorObjects.selection.Count; l++) { ObjectAsset objectAsset; ItemAsset itemAsset; LevelObjects.getAssetEditor(EditorObjects.selection[l].transform, out objectAsset, out itemAsset); if (objectAsset != null || itemAsset != null) { EditorObjects.copies.Add(new EditorCopy(EditorObjects.selection[l].transform.position, EditorObjects.selection[l].transform.rotation, EditorObjects.selection[l].transform.localScale, objectAsset, itemAsset)); } } } if (Input.GetKeyDown(118) && EditorObjects.copies.Count > 0 && Input.GetKey(306)) { EditorObjects.clearSelection(); LevelObjects.step++; for (int m = 0; m < EditorObjects.copies.Count; m++) { Transform transform = LevelObjects.registerAddObject(EditorObjects.copies[m].position, EditorObjects.copies[m].rotation, EditorObjects.copies[m].scale, EditorObjects.copies[m].objectAsset, EditorObjects.copies[m].itemAsset); if (transform != null) { EditorObjects.addSelection(transform); } } } if (EditorObjects.handleType == EDragType.NONE) { if (Input.GetKeyDown(ControlsSettings.primary)) { if (EditorInteract.logicHit.transform != null && (EditorInteract.logicHit.transform.name == "Arrow_X" || EditorInteract.logicHit.transform.name == "Arrow_Y" || EditorInteract.logicHit.transform.name == "Arrow_Z" || EditorInteract.logicHit.transform.name == "Plane_X" || EditorInteract.logicHit.transform.name == "Plane_Y" || EditorInteract.logicHit.transform.name == "Plane_Z" || EditorInteract.logicHit.transform.name == "Circle_X" || EditorInteract.logicHit.transform.name == "Circle_Y" || EditorInteract.logicHit.transform.name == "Circle_Z" || EditorInteract.logicHit.transform.name == "Scale_X" || EditorInteract.logicHit.transform.name == "Scale_Y" || EditorInteract.logicHit.transform.name == "Scale_Z" || EditorInteract.logicHit.transform.name == "Size")) { EditorObjects.mouseOrigin = Input.mousePosition; EditorObjects.transformOrigin = EditorObjects.handle.position; EditorObjects.rotateOrigin = EditorObjects.handle.rotation; EditorObjects.scaleOrigin = EditorObjects.group.localScale; EditorObjects.handleOffset = EditorInteract.logicHit.point - EditorObjects.handle.position; EditorObjects.pointSelection(); if (EditorInteract.logicHit.transform.name == "Arrow_X") { EditorObjects.handleType = EDragType.TRANSFORM_X; } else if (EditorInteract.logicHit.transform.name == "Arrow_Y") { EditorObjects.handleType = EDragType.TRANSFORM_Y; } else if (EditorInteract.logicHit.transform.name == "Arrow_Z") { EditorObjects.handleType = EDragType.TRANSFORM_Z; } else if (EditorInteract.logicHit.transform.name == "Plane_X") { EditorObjects.handleType = EDragType.PLANE_X; } else if (EditorInteract.logicHit.transform.name == "Plane_Y") { EditorObjects.handleType = EDragType.PLANE_Y; } else if (EditorInteract.logicHit.transform.name == "Plane_Z") { EditorObjects.handleType = EDragType.PLANE_Z; } else if (EditorInteract.logicHit.transform.name == "Circle_X") { EditorObjects.rotateInverted = (Vector3.Dot(EditorInteract.logicHit.point - EditorObjects.handle.position, MainCamera.instance.transform.up) < 0f); EditorObjects.handleType = EDragType.ROTATION_X; } else if (EditorInteract.logicHit.transform.name == "Circle_Y") { EditorObjects.rotateInverted = (Vector3.Dot(EditorInteract.logicHit.point - EditorObjects.handle.position, MainCamera.instance.transform.up) < 0f); EditorObjects.handleType = EDragType.ROTATION_Y; } else if (EditorInteract.logicHit.transform.name == "Circle_Z") { EditorObjects.rotateInverted = (Vector3.Dot(EditorInteract.logicHit.point - EditorObjects.handle.position, MainCamera.instance.transform.up) < 0f); EditorObjects.handleType = EDragType.ROTATION_Z; } else if (EditorInteract.logicHit.transform.name == "Scale_X") { EditorObjects.handleType = EDragType.SCALE_X; } else if (EditorInteract.logicHit.transform.name == "Scale_Y") { EditorObjects.handleType = EDragType.SCALE_Y; } else if (EditorInteract.logicHit.transform.name == "Scale_Z") { EditorObjects.handleType = EDragType.SCALE_Z; } else if (EditorInteract.logicHit.transform.name == "Size") { EditorObjects.handleType = EDragType.SIZE; } } else if (EditorInteract.objectHit.transform != null) { if (Input.GetKey(ControlsSettings.modify)) { if (EditorObjects.containsSelection(EditorInteract.objectHit.transform)) { EditorObjects.removeSelection(EditorInteract.objectHit.transform); } else { EditorObjects.addSelection(EditorInteract.objectHit.transform); } } else if (EditorObjects.containsSelection(EditorInteract.objectHit.transform)) { EditorObjects.clearSelection(); } else { EditorObjects.clearSelection(); EditorObjects.addSelection(EditorInteract.objectHit.transform); } } else { if (!EditorObjects.isDragging) { EditorObjects._dragStart.x = EditorUI.window.mouse_x; EditorObjects._dragStart.y = EditorUI.window.mouse_y; } if (!Input.GetKey(ControlsSettings.modify)) { EditorObjects.clearSelection(); } } } else if (Input.GetKey(ControlsSettings.primary) && EditorObjects.dragStart.x != 0f) { EditorObjects._dragEnd.x = EditorUI.window.mouse_x; EditorObjects._dragEnd.y = EditorUI.window.mouse_y; if (EditorObjects.isDragging || Mathf.Abs(EditorObjects.dragEnd.x - EditorObjects.dragStart.x) > 50f || Mathf.Abs(EditorObjects.dragEnd.x - EditorObjects.dragStart.x) > 50f) { int num = (int)EditorObjects.dragStart.x; int num2 = (int)EditorObjects.dragStart.y; if (EditorObjects.dragEnd.x < EditorObjects.dragStart.x) { num = (int)EditorObjects.dragEnd.x; } if (EditorObjects.dragEnd.y < EditorObjects.dragStart.y) { num2 = (int)EditorObjects.dragEnd.y; } int num3 = (int)EditorObjects.dragEnd.x; int num4 = (int)EditorObjects.dragEnd.y; if (EditorObjects.dragStart.x > EditorObjects.dragEnd.x) { num3 = (int)EditorObjects.dragStart.x; } if (EditorObjects.dragStart.y > EditorObjects.dragEnd.y) { num4 = (int)EditorObjects.dragStart.y; } if (EditorObjects.onDragStarted != null) { EditorObjects.onDragStarted(num, num2, num3, num4); } if (!EditorObjects.isDragging) { EditorObjects._isDragging = true; EditorObjects.dragable.Clear(); byte region_x = Editor.editor.area.region_x; byte region_y = Editor.editor.area.region_y; if (Regions.checkSafe((int)region_x, (int)region_y)) { for (int n = (int)(region_x - 1); n <= (int)(region_x + 1); n++) { for (int num5 = (int)(region_y - 1); num5 <= (int)(region_y + 1); num5++) { if (Regions.checkSafe((int)((byte)n), (int)((byte)num5)) && LevelObjects.regions[n, num5]) { for (int num6 = 0; num6 < LevelObjects.objects[n, num5].Count; num6++) { LevelObject levelObject = LevelObjects.objects[n, num5][num6]; if (!(levelObject.transform == null)) { Vector3 newScreen = MainCamera.instance.WorldToScreenPoint(levelObject.transform.position); if (newScreen.z >= 0f) { newScreen.y = (float)Screen.height - newScreen.y; EditorObjects.dragable.Add(new EditorDrag(levelObject.transform, newScreen)); } } } for (int num7 = 0; num7 < LevelObjects.buildables[n, num5].Count; num7++) { LevelBuildableObject levelBuildableObject = LevelObjects.buildables[n, num5][num7]; if (!(levelBuildableObject.transform == null)) { Vector3 newScreen2 = MainCamera.instance.WorldToScreenPoint(levelBuildableObject.transform.position); if (newScreen2.z >= 0f) { newScreen2.y = (float)Screen.height - newScreen2.y; EditorObjects.dragable.Add(new EditorDrag(levelBuildableObject.transform, newScreen2)); } } } } } } } } if (!Input.GetKey(ControlsSettings.modify)) { for (int num8 = 0; num8 < EditorObjects.selection.Count; num8++) { Vector3 vector = MainCamera.instance.WorldToScreenPoint(EditorObjects.selection[num8].transform.position); if (vector.z < 0f) { EditorObjects.removeSelection(EditorObjects.selection[num8].transform); } else { vector.y = (float)Screen.height - vector.y; if (vector.x < (float)num || vector.y < (float)num2 || vector.x > (float)num3 || vector.y > (float)num4) { EditorObjects.removeSelection(EditorObjects.selection[num8].transform); } } } } for (int num9 = 0; num9 < EditorObjects.dragable.Count; num9++) { EditorDrag editorDrag = EditorObjects.dragable[num9]; if (!(editorDrag.transform == null)) { if (!(editorDrag.transform.parent == EditorObjects.group)) { if (editorDrag.screen.x >= (float)num && editorDrag.screen.y >= (float)num2 && editorDrag.screen.x <= (float)num3 && editorDrag.screen.y <= (float)num4) { EditorObjects.addSelection(editorDrag.transform); } } } } } } if (EditorObjects.selection.Count > 0) { if (Input.GetKeyDown(ControlsSettings.tool_2) && EditorInteract.worldHit.transform != null) { EditorObjects.pointSelection(); EditorObjects.handle.position = EditorInteract.worldHit.point; if (Input.GetKey(ControlsSettings.snap)) { EditorObjects.handle.position += EditorInteract.worldHit.normal * EditorObjects.snapTransform; } EditorObjects.updateGroup(); EditorObjects.applySelection(); } if (Input.GetKeyDown(ControlsSettings.focus)) { MainCamera.instance.transform.parent.position = EditorObjects.handle.position - 15f * MainCamera.instance.transform.forward; } } else if (EditorInteract.worldHit.transform != null) { if (EditorInteract.worldHit.transform.CompareTag("Large") || EditorInteract.worldHit.transform.CompareTag("Medium") || EditorInteract.worldHit.transform.CompareTag("Small") || EditorInteract.worldHit.transform.CompareTag("Barricade") || EditorInteract.worldHit.transform.CompareTag("Structure")) { ObjectAsset objectAsset2; ItemAsset itemAsset2; LevelObjects.getAssetEditor(EditorInteract.worldHit.transform, out objectAsset2, out itemAsset2); if (objectAsset2 != null) { EditorUI.hint(EEditorMessage.FOCUS, objectAsset2.objectName); } else if (itemAsset2 != null) { EditorUI.hint(EEditorMessage.FOCUS, itemAsset2.itemName); } } if (Input.GetKeyDown(ControlsSettings.tool_2)) { EditorObjects.handle.position = EditorInteract.worldHit.point; if (Input.GetKey(ControlsSettings.snap)) { EditorObjects.handle.position += EditorInteract.worldHit.normal * EditorObjects.snapTransform; } EditorObjects.handle.rotation = Quaternion.Euler(-90f, 0f, 0f); if (EditorObjects.selectedObjectAsset != null || EditorObjects.selectedItemAsset != null) { LevelObjects.step++; Transform transform2 = LevelObjects.registerAddObject(EditorObjects.handle.position, EditorObjects.handle.rotation, Vector3.one, EditorObjects.selectedObjectAsset, EditorObjects.selectedItemAsset); if (transform2 != null) { EditorObjects.addSelection(transform2); } } } } } } if (Input.GetKeyUp(ControlsSettings.primary) && EditorObjects.dragStart.x != 0f) { EditorObjects._dragStart = Vector2.zero; if (EditorObjects.isDragging) { EditorObjects._dragEnd = Vector2.zero; EditorObjects._isDragging = false; if (EditorObjects.onDragStopped != null) { EditorObjects.onDragStopped(); } } } }
// Token: 0x060028E4 RID: 10468 RVA: 0x000F9060 File Offset: 0x000F7460 private bool updateObjects() { if (Level.info == null || Level.info.type == ELevelType.ARENA) { return(false); } if (LevelObjects.objects[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y].Count <= 0) { return(true); } if ((int)ObjectManager.regions[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y].updateObjectIndex >= LevelObjects.objects[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y].Count) { ObjectManager.regions[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y].updateObjectIndex = (ushort)(LevelObjects.objects[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y].Count - 1); } LevelObject levelObject = LevelObjects.objects[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y][(int)ObjectManager.regions[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y].updateObjectIndex]; if (levelObject == null || levelObject.asset == null) { return(false); } if (levelObject.interactable != null && levelObject.asset.interactabilityReset >= 1f) { if (levelObject.asset.interactability == EObjectInteractability.BINARY_STATE) { if (((InteractableObjectBinaryState)levelObject.interactable).checkCanReset(Provider.modeConfigData.Objects.Binary_State_Reset_Multiplier)) { ObjectManager.manager.channel.send("tellToggleObjectBinaryState", ESteamCall.ALL, ObjectManager.updateObjects_X, ObjectManager.updateObjects_Y, ObjectManager.OBJECT_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { ObjectManager.updateObjects_X, ObjectManager.updateObjects_Y, ObjectManager.regions[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y].updateObjectIndex, false }); LevelObjects.objects[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y][(int)ObjectManager.regions[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y].updateObjectIndex].state[0] = 0; } } else if ((levelObject.asset.interactability == EObjectInteractability.WATER || levelObject.asset.interactability == EObjectInteractability.FUEL) && ((InteractableObjectResource)levelObject.interactable).checkCanReset((levelObject.asset.interactability != EObjectInteractability.WATER) ? Provider.modeConfigData.Objects.Fuel_Reset_Multiplier : Provider.modeConfigData.Objects.Water_Reset_Multiplier)) { ushort num = (ushort)Mathf.Min((int)(((InteractableObjectResource)levelObject.interactable).amount + ((levelObject.asset.interactability != EObjectInteractability.WATER) ? 500 : 1)), (int)((InteractableObjectResource)levelObject.interactable).capacity); ObjectManager.manager.channel.send("tellObjectResource", ESteamCall.ALL, ObjectManager.updateObjects_X, ObjectManager.updateObjects_Y, ObjectManager.OBJECT_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { ObjectManager.updateObjects_X, ObjectManager.updateObjects_Y, ObjectManager.regions[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y].updateObjectIndex, num }); byte[] bytes = BitConverter.GetBytes(num); LevelObjects.objects[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y][(int)ObjectManager.regions[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y].updateObjectIndex].state[0] = bytes[0]; LevelObjects.objects[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y][(int)ObjectManager.regions[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y].updateObjectIndex].state[1] = bytes[1]; } } if (levelObject.rubble != null && levelObject.asset.rubbleReset >= 1f && levelObject.asset.rubble == EObjectRubble.DESTROY) { byte b = levelObject.rubble.checkCanReset(Provider.modeConfigData.Objects.Rubble_Reset_Multiplier); if (b != 255) { byte[] state = LevelObjects.objects[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y][(int)ObjectManager.regions[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y].updateObjectIndex].state; state[state.Length - 1] = (state[state.Length - 1] | Types.SHIFTS[(int)b]); ObjectManager.manager.channel.send("tellObjectRubble", ESteamCall.ALL, ObjectManager.updateObjects_X, ObjectManager.updateObjects_Y, ObjectManager.OBJECT_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[] { ObjectManager.updateObjects_X, ObjectManager.updateObjects_Y, ObjectManager.regions[(int)ObjectManager.updateObjects_X, (int)ObjectManager.updateObjects_Y].updateObjectIndex, b, true, Vector3.zero }); } } return(false); }
// Token: 0x06003516 RID: 13590 RVA: 0x0015F8A4 File Offset: 0x0015DCA4 private static void update(int x, int y) { for (int i = 0; i < (int)EditorLevelVisibilityUI.DEBUG_SIZE; i++) { for (int j = 0; j < (int)EditorLevelVisibilityUI.DEBUG_SIZE; j++) { int num = i * (int)EditorLevelVisibilityUI.DEBUG_SIZE + j; int num2 = x - (int)(EditorLevelVisibilityUI.DEBUG_SIZE / 2) + i; int num3 = y - (int)(EditorLevelVisibilityUI.DEBUG_SIZE / 2) + j; SleekLabel sleekLabel = EditorLevelVisibilityUI.regionLabels[num]; if (Regions.checkSafe(num2, num3)) { int num4 = LevelObjects.objects[num2, num3].Count + LevelGround.trees[num2, num3].Count; int num5 = LevelObjects.total + LevelGround.total; double num6 = Math.Round((double)num4 / (double)num5 * 1000.0) / 10.0; int num7 = 0; for (int k = 0; k < LevelObjects.objects[num2, num3].Count; k++) { LevelObject levelObject = LevelObjects.objects[num2, num3][k]; if (levelObject.transform) { levelObject.transform.GetComponents <MeshFilter>(EditorLevelVisibilityUI.meshes); if (EditorLevelVisibilityUI.meshes.Count == 0) { Transform transform = levelObject.transform.FindChild("Model_0"); if (transform) { transform.GetComponentsInChildren <MeshFilter>(true, EditorLevelVisibilityUI.meshes); } } if (EditorLevelVisibilityUI.meshes.Count != 0) { for (int l = 0; l < EditorLevelVisibilityUI.meshes.Count; l++) { Mesh sharedMesh = EditorLevelVisibilityUI.meshes[l].sharedMesh; if (sharedMesh) { num7 += sharedMesh.triangles.Length; } } } } } for (int m = 0; m < LevelGround.trees[num2, num3].Count; m++) { ResourceSpawnpoint resourceSpawnpoint = LevelGround.trees[num2, num3][m]; if (resourceSpawnpoint.model) { resourceSpawnpoint.model.GetComponents <MeshFilter>(EditorLevelVisibilityUI.meshes); if (EditorLevelVisibilityUI.meshes.Count == 0) { Transform transform2 = resourceSpawnpoint.model.FindChild("Model_0"); if (transform2) { transform2.GetComponentsInChildren <MeshFilter>(true, EditorLevelVisibilityUI.meshes); } } if (EditorLevelVisibilityUI.meshes.Count != 0) { for (int n = 0; n < EditorLevelVisibilityUI.meshes.Count; n++) { Mesh sharedMesh2 = EditorLevelVisibilityUI.meshes[n].sharedMesh; if (sharedMesh2) { num7 += sharedMesh2.triangles.Length; } } } } } long num8 = (long)num4 * (long)num7; float quality = Mathf.Clamp01((float)(1.0 - (double)num8 / 50000000.0)); sleekLabel.text = EditorLevelVisibilityUI.localization.format("Point", new object[] { num2, num3 }); SleekLabel sleekLabel2 = sleekLabel; sleekLabel2.text = sleekLabel2.text + "\n" + EditorLevelVisibilityUI.localization.format("Objects", new object[] { num4, num6 }); SleekLabel sleekLabel3 = sleekLabel; sleekLabel3.text = sleekLabel3.text + "\n" + EditorLevelVisibilityUI.localization.format("Triangles", new object[] { num7 }); if (num4 == 0 && num7 == 0) { sleekLabel.foregroundColor = Color.white; } else { sleekLabel.foregroundColor = ItemTool.getQualityColor(quality); } } } } }
public void calculateBounds() { this.cullMagnitude = 64f * this.bias; this.sqrCullMagnitude = this.cullMagnitude * this.cullMagnitude; if (this.lod == EObjectLOD.MESH) { ObjectsLOD.meshes.Clear(); base.GetComponentsInChildren <MeshFilter>(true, ObjectsLOD.meshes); if (ObjectsLOD.meshes.Count == 0) { base.enabled = false; return; } Bounds item = default(Bounds); for (int i = 0; i < ObjectsLOD.meshes.Count; i++) { Mesh sharedMesh = ObjectsLOD.meshes[i].sharedMesh; if (!(sharedMesh == null)) { Bounds bounds = sharedMesh.bounds; item.Encapsulate(bounds.min); item.Encapsulate(bounds.max); } } item.Expand(-1f); item.center += this.center; item.size += this.size; if (item.size.x < 1f || item.size.y < 1f || item.size.z < 1f) { base.enabled = false; return; } this.bounds = new List <Bounds>(); this.bounds.Add(item); } else if (this.lod == EObjectLOD.AREA) { ObjectsLOD.areas.Clear(); base.GetComponentsInChildren <OcclusionArea>(true, ObjectsLOD.areas); if (ObjectsLOD.areas.Count == 0) { base.enabled = false; return; } this.bounds = new List <Bounds>(); for (int j = 0; j < ObjectsLOD.areas.Count; j++) { OcclusionArea occlusionArea = ObjectsLOD.areas[j]; Bounds item2; item2..ctor(occlusionArea.transform.localPosition + occlusionArea.center, new Vector3(occlusionArea.size.x, occlusionArea.size.z, occlusionArea.size.y)); this.bounds.Add(item2); } } this.objects = new List <LevelObject>(); for (int k = 0; k < this.bounds.Count; k++) { Bounds bounds2 = this.bounds[k]; this.cullCenter += bounds2.center; } this.cullCenter /= (float)this.bounds.Count; this.cullCenter = base.transform.TransformPoint(this.cullCenter); byte b; byte b2; Regions.tryGetCoordinate(this.cullCenter, out b, out b2); for (int l = (int)(b - 1); l <= (int)(b + 1); l++) { for (int m = (int)(b2 - 1); m <= (int)(b2 + 1); m++) { for (int n = 0; n < LevelObjects.objects[l, m].Count; n++) { LevelObject levelObject = LevelObjects.objects[l, m][n]; if (levelObject.asset != null && !(levelObject.transform == null) && levelObject.asset.type != EObjectType.LARGE) { if (!levelObject.isSpeciallyCulled) { Vector3 vector = base.transform.InverseTransformPoint(levelObject.transform.position); bool flag = false; for (int num = 0; num < this.bounds.Count; num++) { if (this.bounds[num].Contains(vector)) { flag = true; break; } } if (flag) { levelObject.isSpeciallyCulled = true; this.objects.Add(levelObject); } } } } } } if (this.objects.Count == 0) { base.enabled = false; return; } }
public static void save() { if (Level.info.configData.Use_Legacy_Objects) { River river = new River(Level.info.path + "/Level/Objects.dat", false); river.writeByte(LevelObjects.SAVEDATA_VERSION); river.writeUInt32(LevelObjects.availableInstanceID); for (byte b = 0; b < Regions.WORLD_SIZE; b += 1) { for (byte b2 = 0; b2 < Regions.WORLD_SIZE; b2 += 1) { List <LevelObject> list = LevelObjects.objects[(int)b, (int)b2]; river.writeUInt16((ushort)list.Count); ushort num = 0; while ((int)num < list.Count) { LevelObject levelObject = list[(int)num]; if (levelObject != null && levelObject.transform != null && levelObject.id != 0) { river.writeSingleVector3(levelObject.transform.position); river.writeSingleQuaternion(levelObject.transform.rotation); river.writeSingleVector3(levelObject.transform.localScale); river.writeUInt16(levelObject.id); river.writeString(levelObject.name); river.writeGUID(levelObject.GUID); river.writeByte((byte)levelObject.placementOrigin); river.writeUInt32(levelObject.instanceID); } else { river.writeSingleVector3(Vector3.zero); river.writeSingleQuaternion(Quaternion.identity); river.writeSingleVector3(Vector3.one); river.writeUInt16(0); river.writeString(string.Empty); river.writeGUID(Guid.Empty); river.writeByte(0); river.writeUInt32(0u); Debug.LogError(string.Concat(new object[] { "Found invalid object at ", b, ", ", b2, " with model: ", levelObject.transform, " and ID: ", levelObject.id })); } num += 1; } } } river.closeRiver(); } River river2 = new River(Level.info.path + "/Level/Buildables.dat", false); river2.writeByte(LevelObjects.SAVEDATA_VERSION); for (byte b3 = 0; b3 < Regions.WORLD_SIZE; b3 += 1) { for (byte b4 = 0; b4 < Regions.WORLD_SIZE; b4 += 1) { List <LevelBuildableObject> list2 = LevelObjects.buildables[(int)b3, (int)b4]; river2.writeUInt16((ushort)list2.Count); ushort num2 = 0; while ((int)num2 < list2.Count) { LevelBuildableObject levelBuildableObject = list2[(int)num2]; if (levelBuildableObject != null && levelBuildableObject.transform != null && levelBuildableObject.id != 0) { river2.writeSingleVector3(levelBuildableObject.transform.position); river2.writeSingleQuaternion(levelBuildableObject.transform.rotation); river2.writeUInt16(levelBuildableObject.id); } else { river2.writeSingleVector3(Vector3.zero); river2.writeSingleQuaternion(Quaternion.identity); river2.writeUInt16(0); Debug.LogError(string.Concat(new object[] { "Found invalid object at ", b3, ", ", b4, " with model: ", levelBuildableObject.transform, " and ID: ", levelBuildableObject.id })); } num2 += 1; } } } river2.closeRiver(); }
public static void load() { LevelObjects._models = new GameObject().transform; LevelObjects.models.name = "Objects"; LevelObjects.models.parent = Level.level; LevelObjects.models.tag = "Logic"; LevelObjects.models.gameObject.layer = LayerMasks.LOGIC; LevelObjects._objects = new List <LevelObject> [(int)Regions.WORLD_SIZE, (int)Regions.WORLD_SIZE]; LevelObjects._buildables = new List <LevelBuildableObject> [(int)Regions.WORLD_SIZE, (int)Regions.WORLD_SIZE]; LevelObjects._total = 0; LevelObjects._regions = new bool[(int)Regions.WORLD_SIZE, (int)Regions.WORLD_SIZE]; LevelObjects._loads = new int[(int)Regions.WORLD_SIZE, (int)Regions.WORLD_SIZE]; LevelObjects.shouldInstantlyLoad = true; LevelObjects.isHierarchyReady = false; for (byte b = 0; b < Regions.WORLD_SIZE; b += 1) { for (byte b2 = 0; b2 < Regions.WORLD_SIZE; b2 += 1) { LevelObjects.loads[(int)b, (int)b2] = -1; } } for (byte b3 = 0; b3 < Regions.WORLD_SIZE; b3 += 1) { for (byte b4 = 0; b4 < Regions.WORLD_SIZE; b4 += 1) { LevelObjects.objects[(int)b3, (int)b4] = new List <LevelObject>(); LevelObjects.buildables[(int)b3, (int)b4] = new List <LevelBuildableObject>(); } } if (Level.info.configData.Use_Legacy_Objects) { if (ReadWrite.fileExists(Level.info.path + "/Level/Objects.dat", false, false)) { River river = new River(Level.info.path + "/Level/Objects.dat", false); byte b5 = river.readByte(); bool flag = true; if (b5 > 0) { if (b5 > 1 && b5 < 3) { river.readSteamID(); } if (b5 > 8) { LevelObjects.availableInstanceID = river.readUInt32(); } else { LevelObjects.availableInstanceID = 1u; } for (byte b6 = 0; b6 < Regions.WORLD_SIZE; b6 += 1) { for (byte b7 = 0; b7 < Regions.WORLD_SIZE; b7 += 1) { ushort num = river.readUInt16(); for (ushort num2 = 0; num2 < num; num2 += 1) { Vector3 vector = river.readSingleVector3(); Quaternion newRotation = river.readSingleQuaternion(); Vector3 newScale; if (b5 > 3) { newScale = river.readSingleVector3(); } else { newScale = Vector3.one; } ushort num3 = river.readUInt16(); string newName = string.Empty; if (b5 > 5) { newName = river.readString(); } Guid newGUID = Guid.Empty; if (b5 > 7) { newGUID = river.readGUID(); } ELevelObjectPlacementOrigin newPlacementOrigin = ELevelObjectPlacementOrigin.MANUAL; if (b5 > 6) { newPlacementOrigin = (ELevelObjectPlacementOrigin)river.readByte(); } uint newInstanceID; if (b5 > 8) { newInstanceID = river.readUInt32(); } else { newInstanceID = LevelObjects.generateUniqueInstanceID(); } if (num3 != 0) { LevelObject levelObject = new LevelObject(vector, newRotation, newScale, num3, newName, newGUID, newPlacementOrigin, newInstanceID); if (levelObject.asset == null) { flag = false; } if (Level.isEditor) { byte b8; byte b9; Regions.tryGetCoordinate(vector, out b8, out b9); if (b8 != b6 || b9 != b7) { Debug.LogError(string.Concat(new object[] { num3, " should be in ", b8, ", ", b9, " but was in ", b6, ", ", b7, "!" })); } LevelObjects.objects[(int)b8, (int)b9].Add(levelObject); } else { LevelObjects.objects[(int)b6, (int)b7].Add(levelObject); } LevelObjects._total++; } } } } } if (flag) { LevelObjects._hash = river.getHash(); } else { LevelObjects._hash = new byte[20]; } river.closeRiver(); } else { for (byte b10 = 0; b10 < Regions.WORLD_SIZE; b10 += 1) { for (byte b11 = 0; b11 < Regions.WORLD_SIZE; b11 += 1) { if (ReadWrite.fileExists(string.Concat(new object[] { Level.info.path, "/Objects/Objects_", b10, "_", b11, ".dat" }), false, false)) { River river2 = new River(string.Concat(new object[] { Level.info.path, "/Objects/Objects_", b10, "_", b11, ".dat" }), false); byte b12 = river2.readByte(); if (b12 > 0) { ushort num4 = river2.readUInt16(); for (ushort num5 = 0; num5 < num4; num5 += 1) { Vector3 position = river2.readSingleVector3(); Quaternion rotation = river2.readSingleQuaternion(); ushort num6 = river2.readUInt16(); string empty = string.Empty; Guid empty2 = Guid.Empty; ELevelObjectPlacementOrigin placementOrigin = ELevelObjectPlacementOrigin.MANUAL; if (num6 != 0) { LevelObjects.addObject(position, rotation, Vector3.one, num6, empty, empty2, placementOrigin); } } } river2.closeRiver(); } } } LevelObjects._hash = new byte[20]; } } else { LevelObjects._hash = new byte[20]; } if ((Provider.isServer || Level.isEditor) && ReadWrite.fileExists(Level.info.path + "/Level/Buildables.dat", false, false)) { River river3 = new River(Level.info.path + "/Level/Buildables.dat", false); river3.readByte(); for (byte b13 = 0; b13 < Regions.WORLD_SIZE; b13 += 1) { for (byte b14 = 0; b14 < Regions.WORLD_SIZE; b14 += 1) { ushort num7 = river3.readUInt16(); for (ushort num8 = 0; num8 < num7; num8 += 1) { Vector3 vector2 = river3.readSingleVector3(); Quaternion newRotation2 = river3.readSingleQuaternion(); ushort num9 = river3.readUInt16(); if (num9 != 0) { LevelBuildableObject item = new LevelBuildableObject(vector2, newRotation2, num9); if (Level.isEditor) { byte b15; byte b16; Regions.tryGetCoordinate(vector2, out b15, out b16); if (b15 != b13 || b16 != b14) { Debug.LogError(string.Concat(new object[] { num9, " should be in ", b15, ", ", b16, " but was in ", b13, ", ", b14, "!" })); } LevelObjects.buildables[(int)b15, (int)b16].Add(item); } else { LevelObjects.buildables[(int)b13, (int)b14].Add(item); } LevelObjects._total++; } } } } river3.closeRiver(); } if (Level.info.configData.Use_Legacy_Objects && !Dedicator.isDedicated && !Level.isEditor) { for (byte b17 = 0; b17 < Regions.WORLD_SIZE; b17 += 1) { for (byte b18 = 0; b18 < Regions.WORLD_SIZE; b18 += 1) { for (int i = 0; i < LevelObjects.objects[(int)b17, (int)b18].Count; i++) { LevelObject levelObject2 = LevelObjects.objects[(int)b17, (int)b18][i]; if (levelObject2.asset != null && !(levelObject2.transform == null)) { if (levelObject2.asset.lod != EObjectLOD.NONE) { ObjectsLOD objectsLOD = levelObject2.transform.gameObject.AddComponent <ObjectsLOD>(); objectsLOD.lod = levelObject2.asset.lod; objectsLOD.bias = levelObject2.asset.lodBias; objectsLOD.center = levelObject2.asset.lodCenter; objectsLOD.size = levelObject2.asset.lodSize; objectsLOD.calculateBounds(); } } } } } } if (Level.isEditor) { LevelObjects.reun = new IReun[256]; LevelObjects.step = 0; LevelObjects.frame = 0; } }
public static void unregisterDevkitObject(LevelObject levelObject, byte x, byte y) { LevelObjects.objects[(int)x, (int)y].Remove(levelObject); }
public static void moveDevkitObject(LevelObject levelObject, byte old_x, byte old_y, byte new_x, byte new_y) { LevelObjects.objects[(int)old_x, (int)old_y].Remove(levelObject); LevelObjects.objects[(int)new_x, (int)new_y].Add(levelObject); }
public static void transformObject(Transform select, Vector3 toPosition, Quaternion toRotation, Vector3 toScale, Vector3 fromPosition, Quaternion fromRotation, Vector3 fromScale) { byte b; byte b2; if (Regions.tryGetCoordinate(fromPosition, out b, out b2)) { byte b3; byte b4; if (Regions.tryGetCoordinate(toPosition, out b3, out b4)) { LevelObject levelObject = null; int index = -1; for (int i = 0; i < LevelObjects.objects[(int)b, (int)b2].Count; i++) { if (LevelObjects.objects[(int)b, (int)b2][i].transform == select) { levelObject = LevelObjects.objects[(int)b, (int)b2][i]; index = i; break; } } if (levelObject != null) { if (b != b3 || b2 != b4) { LevelObjects.objects[(int)b, (int)b2].RemoveAt(index); LevelObjects.objects[(int)b3, (int)b4].Add(levelObject); } if (levelObject.transform != null) { levelObject.transform.position = toPosition; levelObject.transform.rotation = toRotation; levelObject.transform.localScale = toScale; } if (levelObject.skybox != null) { levelObject.skybox.position = toPosition; levelObject.skybox.rotation = toRotation; levelObject.skybox.localScale = toScale; } } else { LevelBuildableObject levelBuildableObject = null; int index2 = -1; for (int j = 0; j < LevelObjects.buildables[(int)b, (int)b2].Count; j++) { if (LevelObjects.buildables[(int)b, (int)b2][j].transform == select) { levelBuildableObject = LevelObjects.buildables[(int)b, (int)b2][j]; index2 = j; break; } } if (levelBuildableObject != null) { if (b != b3 || b2 != b4) { LevelObjects.buildables[(int)b, (int)b2].RemoveAt(index2); LevelObjects.buildables[(int)b3, (int)b4].Add(levelBuildableObject); } if (levelBuildableObject.transform != null) { levelBuildableObject.transform.position = toPosition; levelBuildableObject.transform.rotation = toRotation; } } else { select.position = fromPosition; select.rotation = fromRotation; select.localScale = fromScale; } } } else { select.position = fromPosition; select.rotation = fromRotation; select.localScale = fromScale; } } else { select.position = fromPosition; select.rotation = fromRotation; select.localScale = fromScale; } }
public virtual void read(SteamChannel channel) { this.sequence = (int)channel.read(Types.INT32_TYPE); this.recov = (int)channel.read(Types.INT32_TYPE); this.keys = (ushort)channel.read(Types.UINT16_TYPE); byte b = (byte)channel.read(Types.BYTE_TYPE); if (b > 0) { this.serversideInputs = new Queue <InputInfo>((int)b); for (byte b2 = 0; b2 < b; b2 += 1) { InputInfo inputInfo = new InputInfo(); inputInfo.type = (ERaycastInfoType)((byte)channel.read(Types.BYTE_TYPE)); switch (inputInfo.type) { case ERaycastInfoType.NONE: inputInfo.point = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.normal = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.material = (EPhysicsMaterial)((byte)channel.read(Types.BYTE_TYPE)); break; case ERaycastInfoType.SKIP: inputInfo = null; break; case ERaycastInfoType.OBJECT: { inputInfo.point = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.direction = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.normal = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.material = (EPhysicsMaterial)((byte)channel.read(Types.BYTE_TYPE)); inputInfo.section = (byte)channel.read(Types.BYTE_TYPE); byte x = (byte)channel.read(Types.BYTE_TYPE); byte y = (byte)channel.read(Types.BYTE_TYPE); ushort index = (ushort)channel.read(Types.UINT16_TYPE); LevelObject @object = ObjectManager.getObject(x, y, index); if (@object != null && @object.transform != null && (inputInfo.point - @object.transform.position).sqrMagnitude < 256f) { inputInfo.transform = @object.transform; } else { inputInfo.type = ERaycastInfoType.NONE; } break; } case ERaycastInfoType.PLAYER: { inputInfo.point = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.direction = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.normal = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.limb = (ELimb)((byte)channel.read(Types.BYTE_TYPE)); CSteamID steamID = (CSteamID)channel.read(Types.STEAM_ID_TYPE); Player player = PlayerTool.getPlayer(steamID); if (player != null && (inputInfo.point - player.transform.position).sqrMagnitude < 256f) { inputInfo.material = EPhysicsMaterial.FLESH_DYNAMIC; inputInfo.player = player; inputInfo.transform = player.transform; } else { inputInfo = null; } break; } case ERaycastInfoType.ZOMBIE: { inputInfo.point = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.direction = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.normal = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.limb = (ELimb)((byte)channel.read(Types.BYTE_TYPE)); ushort id = (ushort)channel.read(Types.UINT16_TYPE); Zombie zombie = ZombieManager.getZombie(inputInfo.point, id); if (zombie != null && (inputInfo.point - zombie.transform.position).sqrMagnitude < 256f) { if (zombie.isRadioactive) { inputInfo.material = EPhysicsMaterial.ALIEN_DYNAMIC; } else { inputInfo.material = EPhysicsMaterial.FLESH_DYNAMIC; } inputInfo.zombie = zombie; inputInfo.transform = zombie.transform; } else { inputInfo = null; } break; } case ERaycastInfoType.ANIMAL: { inputInfo.point = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.direction = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.normal = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.limb = (ELimb)((byte)channel.read(Types.BYTE_TYPE)); ushort index2 = (ushort)channel.read(Types.UINT16_TYPE); Animal animal = AnimalManager.getAnimal(index2); if (animal != null && (inputInfo.point - animal.transform.position).sqrMagnitude < 256f) { inputInfo.material = EPhysicsMaterial.FLESH_DYNAMIC; inputInfo.animal = animal; inputInfo.transform = animal.transform; } else { inputInfo = null; } break; } case ERaycastInfoType.VEHICLE: { inputInfo.point = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.normal = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.material = (EPhysicsMaterial)((byte)channel.read(Types.BYTE_TYPE)); uint instanceID = (uint)channel.read(Types.UINT32_TYPE); InteractableVehicle vehicle = VehicleManager.getVehicle(instanceID); if (vehicle != null && (vehicle == channel.owner.player.movement.getVehicle() || (inputInfo.point - vehicle.transform.position).sqrMagnitude < 4096f)) { inputInfo.vehicle = vehicle; inputInfo.transform = vehicle.transform; } else { inputInfo = null; } break; } case ERaycastInfoType.BARRICADE: { inputInfo.point = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.normal = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.material = (EPhysicsMaterial)((byte)channel.read(Types.BYTE_TYPE)); byte x2 = (byte)channel.read(Types.BYTE_TYPE); byte y2 = (byte)channel.read(Types.BYTE_TYPE); ushort plant = (ushort)channel.read(Types.UINT16_TYPE); ushort num = (ushort)channel.read(Types.UINT16_TYPE); BarricadeRegion barricadeRegion; if (BarricadeManager.tryGetRegion(x2, y2, plant, out barricadeRegion) && (int)num < barricadeRegion.drops.Count) { Transform model = barricadeRegion.drops[(int)num].model; if (model != null && (inputInfo.point - model.transform.position).sqrMagnitude < 256f) { inputInfo.transform = model; } else { inputInfo = null; } } else { inputInfo = null; } break; } case ERaycastInfoType.STRUCTURE: { inputInfo.point = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.direction = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.normal = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.material = (EPhysicsMaterial)((byte)channel.read(Types.BYTE_TYPE)); byte x3 = (byte)channel.read(Types.BYTE_TYPE); byte y3 = (byte)channel.read(Types.BYTE_TYPE); ushort num2 = (ushort)channel.read(Types.UINT16_TYPE); StructureRegion structureRegion; if (StructureManager.tryGetRegion(x3, y3, out structureRegion) && (int)num2 < structureRegion.drops.Count) { Transform model2 = structureRegion.drops[(int)num2].model; if (model2 != null && (inputInfo.point - model2.transform.position).sqrMagnitude < 256f) { inputInfo.transform = model2; } else { inputInfo = null; } } else { inputInfo = null; } break; } case ERaycastInfoType.RESOURCE: { inputInfo.point = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.direction = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.normal = (Vector3)channel.read(Types.VECTOR3_TYPE); inputInfo.material = (EPhysicsMaterial)((byte)channel.read(Types.BYTE_TYPE)); byte x4 = (byte)channel.read(Types.BYTE_TYPE); byte y4 = (byte)channel.read(Types.BYTE_TYPE); ushort index3 = (ushort)channel.read(Types.UINT16_TYPE); Transform resource = ResourceManager.getResource(x4, y4, index3); if (resource != null && (inputInfo.point - resource.transform.position).sqrMagnitude < 256f) { inputInfo.transform = resource; } else { inputInfo = null; } break; } } if (inputInfo != null) { this.serversideInputs.Enqueue(inputInfo); } } } }