void AFPSGCharacter::manageWeapon(AFPSGWeapon* in_weapon) { bool weaponFound = isInInventory(in_weapon); //This weapon was found in the inventory, only add its ammunition if (weaponFound) { //GEngine->AddOnScreenDebugMessage(-1, 6.0f, FColor::Red, "weaponFound"); AFPSGWeapon* weapon = findWeapon(in_weapon); if (weapon != NULL) { //GEngine->AddOnScreenDebugMessage(-1, 6.0f, FColor::Red, "Add ammunition"); weapon->setCurrentAmmunition(weapon->getCurrentAmmunition() + in_weapon->getCurrentAmmunition()); } } else //Otherwise, add the weapon { //GEngine->AddOnScreenDebugMessage(-1, 6.0f, FColor::Red, "weapon NOT found"); //Spawn the weapon AFPSGWeapon* spawnedWeapon = spawnWeapon(in_weapon, FVector::ZeroVector, FRotator::ZeroRotator); //Disable the weapons collision component, attach to character and set to invisible, then add it to the inventory if (spawnedWeapon != NULL) { spawnedWeapon->getBoxCollisionComponent()->UnregisterComponent(); spawnedWeapon->AttachRootComponentTo(GetMesh(), inventoryWeaponSocket, EAttachLocation::SnapToTarget); spawnedWeapon->SetActorHiddenInGame(true); addWeapon(spawnedWeapon); } } }
void CityDecorationMenuComponent::fillObjectMenuResponse(SceneObject* sceneObject, ObjectMenuResponse* menuResponse, CreatureObject* player) { TangibleObjectMenuComponent::fillObjectMenuResponse(sceneObject, menuResponse, player); ManagedReference<CityRegion*> city = player->getCityRegion(); if(isInInventory(sceneObject, player) && player->getParent() == NULL) { menuResponse->addRadialMenuItem(233, 3, "@city/city:place"); // Place Decoration } if(city != NULL && sceneObject->getParent().get() == NULL && sceneObject->getCityRegion() == city && city->isMayor(player->getObjectID()) ) { menuResponse->addRadialMenuItem(234, 3, "@city/city:mt_remove"); // Remove menuResponse->addRadialMenuItem(73, 3, "@city/city:align"); // Align menuResponse->addRadialMenuItemToRadialID(73, 74, 3, "@city/city:north"); // North menuResponse->addRadialMenuItemToRadialID(73, 75, 3, "@city/city:east"); // East menuResponse->addRadialMenuItemToRadialID(73, 76, 3, "@city/city:south"); // South menuResponse->addRadialMenuItemToRadialID(73, 77, 3, "@city/city:west"); // West } }