mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-10-06 21:13:09 -04:00
Merge branch 'master' into 'master'
tried rearranging the packup but it didn't really help...it just fails more efficiently now, lol See merge request !23
This commit is contained in:
@@ -3010,7 +3010,15 @@ void finalizePackUp(obj_id player, obj_id structure)
|
||||
blog("player_structure.finalizePackUp isAbandoned: "+isAbandoned);
|
||||
|
||||
obj_id structure_owner = getOwner(structure);
|
||||
|
||||
location where = getLocation(structure);
|
||||
string structName = getStructureName(structure);
|
||||
|
||||
// Get the structure name
|
||||
if (structName == null || structName.length() < 1)
|
||||
{
|
||||
structName = "Building";
|
||||
}
|
||||
|
||||
if(structure_owner != player && isAbandoned)
|
||||
{
|
||||
CustomerServiceLog("housepackup", "Structure (" + structure + ") was abandoned and was not being packed by Owner ("
|
||||
@@ -3050,7 +3058,106 @@ void finalizePackUp(obj_id player, obj_id structure)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isBuilding(structure))
|
||||
{
|
||||
// eject all players from house
|
||||
obj_id[] players = getPlayersInBuilding(structure);
|
||||
if (players != null)
|
||||
{
|
||||
for (int i = 0; i < players.length; i++)
|
||||
{
|
||||
expelFromBuilding(players[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Destroy vendors inside this structure.
|
||||
string[] cells = getCellNames(structure);
|
||||
if( cells != null)
|
||||
{
|
||||
for(int i = 0; i < cells.length; i++)
|
||||
{
|
||||
obj_id cellid = getCellId(structure, cells[i]);
|
||||
obj_id contents[] = getContents(cellid);
|
||||
if(contents != null)
|
||||
{
|
||||
for(int j=0; j<contents.length; j++)
|
||||
{
|
||||
if(hasCondition(contents[j], CONDITION_VENDOR))
|
||||
{
|
||||
obj_id owner = getObjIdObjVar(contents[j], "vendor_owner");
|
||||
if (!isIdValid(owner))
|
||||
owner = getOwner( contents[j] );
|
||||
|
||||
vendor_lib.finalizePackUp(owner, contents[j], player, player_structure.isAbandoned(structure));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new structure control device
|
||||
obj_id scd = createObject("object/intangible/house/generic_house_control_device.iff", where);
|
||||
|
||||
setName(scd, structName);
|
||||
setOwner(scd, player);
|
||||
|
||||
// Persist the structure control device
|
||||
if (!persistObject(scd))
|
||||
{
|
||||
LOG("LOG_CHANNEL", "player_structure.finalizePackup persist SCD failed!");
|
||||
}
|
||||
|
||||
attachScript(scd, "structure.house_control_device");
|
||||
|
||||
// destroy waypoint if it exists
|
||||
if(hasObjVar(structure, VAR_WAYPOINT_STRUCTURE))
|
||||
{
|
||||
obj_id waypoint = getObjIdObjVar(structure, VAR_WAYPOINT_STRUCTURE);
|
||||
if(isIdValid(waypoint))
|
||||
{
|
||||
destroyWaypointInDatapad(waypoint, player);
|
||||
removeObjVar(structure, VAR_WAYPOINT_STRUCTURE);
|
||||
}
|
||||
}
|
||||
|
||||
// Destroy house sign and name the control device whatever the building name was
|
||||
destroyStructureSign(structure);
|
||||
//destroyBaseObjects(structure);
|
||||
|
||||
// Remove the structure as the player's residence
|
||||
if ( isResidence( structure, player ) )
|
||||
{
|
||||
setHouseId( player, obj_id.NULL_ID );
|
||||
removeObjVar( structure, VAR_RESIDENCE_BUILDING );
|
||||
|
||||
// Also remove the player from his current city.
|
||||
city.removeCitizen( player, structure );
|
||||
}
|
||||
|
||||
city.removeStructureFromCity( structure );
|
||||
|
||||
// set the template objvar, this is required by the re-placement code
|
||||
string template = getTemplateName(structure);
|
||||
setDeedTemplate(scd, template);
|
||||
|
||||
// if the structure is a "lot over limit structure", set objvar to indicate it has been moved to the datapad
|
||||
if (isIdValid(player) && exists(player))
|
||||
{
|
||||
obj_id lotOverlimitStructure = getObjIdObjVar(player, "lotOverlimit.structure_id");
|
||||
if (isIdValid(lotOverlimitStructure) && (lotOverlimitStructure == structure))
|
||||
{
|
||||
setObjVar(player, "lotOverlimit.structure_location", "Datapad");
|
||||
}
|
||||
}
|
||||
|
||||
// put the house into the structure control device
|
||||
putIn(structure, scd );
|
||||
}
|
||||
|
||||
blog("player_structure.finalizePackUp getting datapad");
|
||||
|
||||
|
||||
// get data pad
|
||||
obj_id datapad = utils.getPlayerDatapad(player);
|
||||
if(!isIdValid(datapad))
|
||||
@@ -3083,52 +3190,7 @@ void finalizePackUp(obj_id player, obj_id structure)
|
||||
);
|
||||
deactivate(structure);
|
||||
}
|
||||
// eject all players from house
|
||||
obj_id[] players = getPlayersInBuilding(structure);
|
||||
if (players != null)
|
||||
{
|
||||
blog("player_structure.finalizePackUp Players are in the building that is about to be packed.");
|
||||
|
||||
for (int i = 0; i < players.length; i++)
|
||||
{
|
||||
expelFromBuilding(players[i]);
|
||||
}
|
||||
}
|
||||
// Destroy vendors inside this structure.
|
||||
string[] cells = getCellNames(structure);
|
||||
if( cells != null)
|
||||
{
|
||||
for(int i = 0; i < cells.length; i++)
|
||||
{
|
||||
obj_id cellid = getCellId(structure, cells[i]);
|
||||
obj_id contents[] = getContents(cellid);
|
||||
if(contents != null)
|
||||
{
|
||||
for(int j=0; j<contents.length; j++)
|
||||
{
|
||||
if(hasCondition(contents[j], CONDITION_VENDOR))
|
||||
{
|
||||
obj_id owner = getObjIdObjVar(contents[j], "vendor_owner");
|
||||
if (!isIdValid(owner))
|
||||
owner = getOwner( contents[j] );
|
||||
|
||||
vendor_lib.finalizePackUp(owner, contents[j], player, isAbandoned);
|
||||
}
|
||||
|
||||
if(isIdValid(contents[j]))
|
||||
{
|
||||
messageTo(contents[j], "OnPack", null, 1.0f, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Get the structure name
|
||||
string structName = getStructureName(structure);
|
||||
if (structName == null || structName.length() < 1)
|
||||
{
|
||||
structName = "Building";
|
||||
}
|
||||
// destroy waypoint if it exists
|
||||
if(hasObjVar(structure, VAR_WAYPOINT_STRUCTURE))
|
||||
{
|
||||
@@ -3167,26 +3229,24 @@ void finalizePackUp(obj_id player, obj_id structure)
|
||||
setObjVar(scd, VAR_DEED_SCENE, getDeedScene(structure));
|
||||
}
|
||||
|
||||
location where = getLocation(structure);
|
||||
|
||||
// if the structure is a "lot over limit structure", set objvar to indicate it has been moved to the datapad
|
||||
if (isIdValid(structure_owner) && exists(structure_owner))
|
||||
if (isIdValid(player) && exists(player))
|
||||
{
|
||||
obj_id lotOverlimitStructure = getObjIdObjVar(structure_owner, "lotOverlimit.structure_id");
|
||||
obj_id lotOverlimitStructure = getObjIdObjVar(player, "lotOverlimit.structure_id");
|
||||
if (isIdValid(lotOverlimitStructure) && (lotOverlimitStructure == structure))
|
||||
{
|
||||
setObjVar(structure_owner, "lotOverlimit.structure_location", "Datapad");
|
||||
setObjVar(player, "lotOverlimit.structure_location", "Datapad");
|
||||
}
|
||||
}
|
||||
|
||||
// put the house into the structure control device
|
||||
putIn(structure, scd);
|
||||
if ( !structure_owner.isLoaded() )
|
||||
if ( !player.isLoaded() )
|
||||
{
|
||||
const int maxDepth = isFactory(structure) ? 101 : 1;
|
||||
|
||||
moveToOfflinePlayerDatapadAndUnload(scd, structure_owner, maxDepth + 1); // add one for the scd
|
||||
fixLoadWith(structure, structure_owner, maxDepth);
|
||||
moveToOfflinePlayerDatapadAndUnload(scd, player, maxDepth + 1); // add one for the scd
|
||||
fixLoadWith(structure, player, maxDepth);
|
||||
}
|
||||
|
||||
CustomerServiceLog("housepackup", "Player/Owner " + getPlayerName(player) +
|
||||
|
||||
Reference in New Issue
Block a user