Skip to content

Commit

Permalink
Add JSON usage to every drone/tank/turret WC asset
Browse files Browse the repository at this point in the history
  • Loading branch information
rudderbucky committed Jun 18, 2023
1 parent 1684a01 commit c728f83
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -885,11 +885,21 @@ public Entity SpawnEntity(EntityBlueprint blueprint, Sector.LevelEntity data)
case EntityBlueprint.IntendedType.Turret:
{
gObj.AddComponent<Turret>();
json = data.blueprintJSON;
if (!string.IsNullOrEmpty(json))
{
blueprint = TryGettingEntityBlueprint(json);
}
break;
}
case EntityBlueprint.IntendedType.Tank:
{
gObj.AddComponent<Tank>();
json = data.blueprintJSON;
if (!string.IsNullOrEmpty(json))
{
blueprint = TryGettingEntityBlueprint(json);
}
break;
}
case EntityBlueprint.IntendedType.Bunker:
Expand Down Expand Up @@ -926,6 +936,11 @@ public Entity SpawnEntity(EntityBlueprint blueprint, Sector.LevelEntity data)
case EntityBlueprint.IntendedType.Drone:
{
Drone drone = gObj.AddComponent<Drone>();
json = data.blueprintJSON;
if (!string.IsNullOrEmpty(json))
{
blueprint = TryGettingEntityBlueprint(json);
}
//drone.path = ResourceManager.GetAsset<Path>(data.pathID);
break;
}
Expand Down
11 changes: 9 additions & 2 deletions Assets/World Creator Assets/Scripts/WCGeneratorHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,13 @@ IEnumerator WriteWorldCo(string path)
}

var charExists = cursor.characters.Exists(ch => ch.ID == ent.ID);
var jsonSensitiveAssets = new List<string>() {"groundcarrier_blueprint" ,"carrier_blueprint" ,"outpost_blueprint"
,"bunker_blueprint" ,"missile_station" ,"air_weapon_station", "defense_turret",
"siege_turret", "harvester_turret", "missile_turret", "torpedo_turret", "mini_drone_blueprint", "worker_drone_blueprint",
"strike_drone_blueprint", "light_drone_blueprint", "gun_drone_blueprint", "counter_drone_blueprint",
"torpedo_drone_blueprint", "heavy_drone_blueprint", "speeder_tank", "bullet_tank",
"missile_tank", "beam_tank", "laser_tank", "rocket_tank"};

if (ent.assetID == "shellcore_blueprint" || charExists)
{
if (container.type != Sector.SectorType.SiegeZone && !sectTargetIDS[container].Contains(ent.ID))
Expand Down Expand Up @@ -428,8 +435,8 @@ IEnumerator WriteWorldCo(string path)
AttemptAddPartArray(traderInventory.parts, container.sectorName);
}
}
else if (ent.assetID == "groundcarrier_blueprint" || ent.assetID == "carrier_blueprint" || ent.assetID == "outpost_blueprint"
|| ent.assetID == "bunker_blueprint" || ent.assetID == "missile_station" || ent.assetID == "air_weapon_station")

else if (jsonSensitiveAssets.Contains(ent.assetID))
{
ent.blueprintJSON = item.shellcoreJSON;
}
Expand Down

0 comments on commit c728f83

Please sign in to comment.