mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-07-14 00:02:07 -04:00
Construction pylons added to structure placement service
Like harvesters, houses feature the construction pylons now when placing a structure. Partially fixing #840
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
import sys
|
||||
import time
|
||||
|
||||
def buildConstructor(core):
|
||||
time.sleep(10)
|
||||
return
|
||||
|
||||
@@ -1243,6 +1243,10 @@ public class DevService implements INetworkDispatch {
|
||||
deed.setIntAttribute("examine_maintenance_rate", 15);
|
||||
inventory.add(deed);
|
||||
|
||||
deed = (TangibleObject) core.objectService.createObject("object/tangible/deed/guild_deed/shared_tatooine_guild_deed.iff", planet);
|
||||
deed.setIntAttribute("examine_maintenance_rate", 15);
|
||||
inventory.add(deed);
|
||||
|
||||
return;
|
||||
|
||||
case 121:
|
||||
|
||||
@@ -113,8 +113,10 @@ public class HousingService implements INetworkDispatch {
|
||||
HouseTemplate houseTemplate = housingTemplates.get(deed.getTemplate());
|
||||
int structureLotCost = houseTemplate.getLotCost();
|
||||
String structureTemplate = houseTemplate.getBuildingTemplate();
|
||||
PlayerCity city = core.playerCityService.getCityPositionIsIn(new Point3D(positionX, 0, positionZ));
|
||||
|
||||
//PlayerCity city = core.playerCityService.getCityPositionIsIn(new Point3D(positionX, 0, positionZ));
|
||||
// This function is not implemented, so it had to be commented out, because it resulted in an error
|
||||
// Whoever wrote this, should still add the method to playerCityService, then it can be uncommented here.
|
||||
PlayerCity city = null;
|
||||
if (!houseTemplate.canBePlacedOn(actor.getPlanet().getName())) {
|
||||
actor.sendSystemMessage("You may not place this structure on this planet.", (byte) 0); // should probably load this from an stf
|
||||
return null;
|
||||
@@ -142,6 +144,12 @@ public class HousingService implements INetworkDispatch {
|
||||
|
||||
float positionY = core.terrainService.getHeight(actor.getPlanetId(), positionX, positionZ) + 2f;
|
||||
|
||||
String constructorTemplate = mapConstructor(structureTemplate);
|
||||
InstallationObject constructors = (InstallationObject) core.objectService.createObject(constructorTemplate, 0, actor.getPlanet(), new Point3D(positionX, positionY, positionZ), quaternion);
|
||||
core.simulationService.add(constructors, positionX, positionZ, true);
|
||||
core.scriptService.callScript("scripts/", "constructor_build_phase", "buildConstructor", core);
|
||||
core.objectService.destroyObject(constructors);
|
||||
|
||||
// Create the building
|
||||
BuildingObject building = (BuildingObject) core.objectService.createObject(structureTemplate, 0, actor.getPlanet(), new Point3D(positionX, positionY, positionZ), quaternion);
|
||||
|
||||
@@ -196,6 +204,27 @@ public class HousingService implements INetworkDispatch {
|
||||
return building;
|
||||
}
|
||||
|
||||
public String mapConstructor(String structureTemplate) {
|
||||
String mappedConstructorTemplate = "object/building/player/construction/shared_construction_player_house_generic_small_style_01.iff";
|
||||
if (structureTemplate.contains("small")){
|
||||
mappedConstructorTemplate = "object/building/player/construction/shared_construction_player_house_generic_small_style_01.iff";
|
||||
} else if (structureTemplate.contains("medium")){
|
||||
mappedConstructorTemplate = "object/building/player/construction/shared_construction_player_house_generic_medium_style_01.iff";
|
||||
} else if (structureTemplate.contains("large")){
|
||||
mappedConstructorTemplate = "object/building/player/construction/shared_construction_player_house_generic_large_style_01.iff";
|
||||
}
|
||||
|
||||
if (structureTemplate.contains("guildhall") || structureTemplate.contains("cityhall")){
|
||||
mappedConstructorTemplate = "object/building/player/construction/shared_construction_player_guildhall_corellia_style_01.iff";
|
||||
} else if (structureTemplate.contains("hangar")){
|
||||
mappedConstructorTemplate = "object/building/player/construction/shared_construction_player_house_hangar.iff";
|
||||
} else if (structureTemplate.contains("meditation")){
|
||||
mappedConstructorTemplate = "object/building/player/construction/shared_construction_player_jedi_meditation_room.iff";
|
||||
}
|
||||
// Probably more could be added
|
||||
return mappedConstructorTemplate;
|
||||
}
|
||||
|
||||
public void startMaintenanceTask(BuildingObject building) {
|
||||
|
||||
if(building.getAttachment("isCivicStructure") != null && (boolean) building.getAttachment("isCivicStructure"))
|
||||
|
||||
@@ -291,6 +291,12 @@ public class ObjectService implements INetworkDispatch {
|
||||
|
||||
object = new WeaponObject(objectID, planet, position, orientation, Template);
|
||||
|
||||
} else if(Template.startsWith("object/building/player/construction")) {
|
||||
|
||||
float positionY = core.terrainService.getHeight(planet.getID(), position.x, position.z)-1f;
|
||||
Point3D newpoint = new Point3D(position.x,positionY,position.z);
|
||||
object = new InstallationObject(objectID, planet, newpoint, orientation, Template);
|
||||
|
||||
} else if(Template.startsWith("object/building") || Template.startsWith("object/static/worldbuilding/structures") || Template.startsWith("object/static/structure")){
|
||||
|
||||
object = new BuildingObject(objectID, planet, position, orientation, Template);
|
||||
|
||||
Reference in New Issue
Block a user