public void OnEvent(AtavismEventData eData) { if (eData.eventType == "PLACE_CLAIM_OBJECT") { //if (GetBuildingState() != WorldBuildingState.PlaceItem) // return; OID itemOID = OID.fromString(eData.eventArgs[0]); itemBeingPlaced = Inventory.Instance.GetInventoryItem(itemOID); // Does the item have a ClaimObject effect? List <int> effectPositions = itemBeingPlaced.GetEffectPositionsOfTypes("ClaimObject"); if (effectPositions.Count == 0) { itemBeingPlaced = null; return; } else { SetBuildingState(WorldBuildingState.PlaceItem); int buildObjectID = int.Parse(itemBeingPlaced.itemEffectValues[effectPositions[0]]); buildTemplate = WorldBuilder.Instance.GetBuildObjectTemplate(buildObjectID); string prefabName = buildTemplate.gameObject.Remove(0, 17); prefabName = prefabName.Remove(prefabName.Length - 7); // Create an instance of the game Object GameObject prefab = (GameObject)Resources.Load(prefabName); GetHitLocation(); SetCurrentReticle((GameObject)UnityEngine.Object.Instantiate(prefab, hitPoint, prefab.transform.rotation)); } } else if (eData.eventType == "START_BUILD_CLAIM_OBJECT") { int buildTemplateID = int.Parse(eData.eventArgs[0]); buildTemplate = WorldBuilder.Instance.GetBuildObjectTemplate(buildTemplateID); Debug.Log("Checking claim type: " + WorldBuilder.Instance.ActiveClaim.claimType + " against: " + buildTemplate.validClaimTypes); // Verify the claim type matches ClaimType activeClaimType = WorldBuilder.Instance.ActiveClaim.claimType; if (activeClaimType != ClaimType.Any && buildTemplate.validClaimTypes != ClaimType.Any) { if (activeClaimType != buildTemplate.validClaimTypes) { string[] args = new string[1]; #if AT_I2LOC_PRESET args[0] = I2.Loc.LocalizationManager.GetTranslation("That object cannot be placed in this Claim"); #else args[0] = "That object cannot be placed in this Claim"; #endif AtavismEventSystem.DispatchEvent("ERROR_MESSAGE", args); return; } } SetBuildingState(WorldBuildingState.PlaceItem); itemBeingPlaced = null; StartPlaceBuildObject(buildTemplateID); } else if (eData.eventType == "CLAIM_OBJECT_CLICKED") { int objectID = int.Parse(eData.eventArgs[0]); if (GetBuildingState() == WorldBuildingState.SelectItem && WorldBuilder.Instance.ActiveClaim.claimObjects.ContainsKey(objectID)) { SetCurrentReticle(WorldBuilder.Instance.ActiveClaim.claimObjects[objectID].gameObject); } } else if (eData.eventType == "CLAIM_CHANGED") { ClearCurrentReticle(true); WorldBuilder.Instance.BuildingState = WorldBuildingState.None; } }