mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-20 10:02:56 -04:00
Updated Housing service
Housing service detects if new citizen builds structure and adds him as citizen to the city
This commit is contained in:
@@ -119,7 +119,9 @@ public class HousingService implements INetworkDispatch {
|
||||
// Name the sign
|
||||
TangibleObject sign = (TangibleObject) building.getAttachment("structureSign");
|
||||
String playerFirstName = actor.getCustomName().split(" ")[0];
|
||||
sign.setCustomName2(playerFirstName + "'s House");
|
||||
|
||||
if (sign !=null)
|
||||
sign.setCustomName2(playerFirstName + "'s House");
|
||||
//building.add(sign);
|
||||
|
||||
core.objectService.destroyObject(deed);
|
||||
@@ -140,6 +142,20 @@ public class HousingService implements INetworkDispatch {
|
||||
actor.setAttachment("residentCity", newCity.getCityID());
|
||||
}
|
||||
|
||||
// Check for city founders joining a new city
|
||||
PlayerCity cityActorIsIn = core.playerCityService.getCityObjectIsIn(actor);
|
||||
|
||||
actor.setAttachment("Has24HZoningFor",cityActorIsIn.getCityID()); // for testing
|
||||
|
||||
int cityActorHasZoning = (int)actor.getAttachment("Has24HZoningFor");
|
||||
if (cityActorIsIn!=null && cityActorHasZoning==cityActorIsIn.getCityID()){
|
||||
if (! cityActorIsIn.getCitizens().contains(actor.getObjectID())){
|
||||
building.setAttachment("structureCity", cityActorIsIn.getCityID());
|
||||
// actor.setAttachment("residentCity", cityActorIsIn.getCityID()); He must do it manually
|
||||
cityActorIsIn.addCitizen(actor.getObjectID());
|
||||
cityActorIsIn.addNewStructure(building.getObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
// Save structure to DB
|
||||
//building.createTransaction(core.getBuildingODB().getEnvironment());
|
||||
@@ -436,6 +452,8 @@ public class HousingService implements INetworkDispatch {
|
||||
public void declareResidency(SWGObject owner, TangibleObject target) {
|
||||
final BuildingObject building = (BuildingObject) target.getAttachment("housing_parentstruct");
|
||||
building.setResidency((CreatureObject)owner);
|
||||
PlayerCity cityActorIsIn = core.playerCityService.getCityObjectIsIn(owner);
|
||||
owner.setAttachment("residentCity", cityActorIsIn.getCityID());
|
||||
//owner.setResidence();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user