Skip to content

Commit

Permalink
1.2.1 Release
Browse files Browse the repository at this point in the history
Supply Raid
* Added additional checks to the buy menu to not display buttons with nothing in them
* Added hiding of buy menu buttons when not on the correct level
* Fixed bug with H3MP causing errors with TnH to SR conversion
* Added delay timer to H3MP Clients when capturing points
* Added Method for adding custom sosigs to the gamemode - Modder request
* Changed No Profiles log from an error to regular log
* Added Max Patrol Size for levels - gives better control on patrol groups
* Changed Sosig rabbit holes to be scalable for mappers, more randomized spawning sosigs

Supply Raid Editor
* Improved directory paths for loading images
* Added missing Buy Category saving/loading
* Attempted to fix data being deleted?

SDK
* Removed H3MP dependency
  • Loading branch information
Packer committed Jul 6, 2024
1 parent 50374c0 commit 41aa55e
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Packer-SupplyRaid/src/Plugin/src/PluginInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ internal static class PluginInfo
{
internal const string NAME = "Supply Raid";
internal const string GUID = "com.Packer.SupplyRaid";
internal const string VERSION = "1.2.0";
internal const string VERSION = "1.2.1";
}
}
38 changes: 38 additions & 0 deletions Packer-SupplyRaid/src/Plugin/src/Scripts/SR_BuyMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ public class SR_BuyMenu : MonoBehaviour
{
public static SR_BuyMenu instance;

public class CategoryButton
{
public GameObject categoryButton;
public SR_ItemCategory itemCategory;
}
public List<CategoryButton> categoryItems = new List<CategoryButton>();

[Header("Spawn Points")]
[SerializeField] Transform[] spawnPoints;

Expand Down Expand Up @@ -167,6 +174,10 @@ private void GenerateButtons()
//Populate Tabs with Buy Buttons
for (int i = 0; i < purchaseCategories.Count; i++)
{
if (purchaseCategories[i].ItemCategory().objectGroups.Count == 0
&& lootTables[i].Loot.Count == 0)
continue;

//Populate all menus
for (int x = 0; x < tabContainers.Length; x++)
{
Expand All @@ -181,10 +192,37 @@ private void GenerateButtons()
newBtn.text.text = purchaseCategories[i].cost.ToString();
newBtn.name = purchaseCategories[i].ItemCategory().name;

//Level management
CategoryButton cBtn = new CategoryButton();
cBtn.itemCategory = purchaseCategories[i].ItemCategory();
cBtn.categoryButton = newBtn.gameObject;
categoryItems.Add(cBtn);

break;
}
}
}
UpdateBuyItems();
}

public void UpdateBuyItems()
{
for (int i = 0; i < categoryItems.Count; i++)
{
if (categoryItems[i] != null)
{
//If -1, always true
if ((categoryItems[i].itemCategory.minLevel == -1 ||
categoryItems[i].itemCategory.minLevel <= SR_Manager.instance.CurrentCaptures)
&& (categoryItems[i].itemCategory.maxLevel == -1 ||
categoryItems[i].itemCategory.maxLevel >= SR_Manager.instance.CurrentCaptures))
{
categoryItems[i].categoryButton.SetActive(true);
}
else
categoryItems[i].categoryButton.SetActive(false);
}
}
}

public void SpawnLootButton(int i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ private void SetupCosts()
int powerIndex = (int)m_detectedMag.ObjectWrapper.TagFirearmRoundPower;
float multiplier = SR_Manager.instance.character.powerMultiplier[powerIndex];

costDuplicate
= SR_Manager.Character().GetRoundCost(
costDuplicate = SR_Manager.Character().GetRoundCost(
SR_Manager.instance.character.duplicateMagazineCost,
m_detectedMag.m_capacity,
multiplier);
Expand Down
42 changes: 39 additions & 3 deletions Packer-SupplyRaid/src/Plugin/src/Scripts/SR_Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,12 @@ void SetupSupplyPoints()
if (forceCaptureOrder != -1)
profile.captureOrder = forceCaptureOrder;

//Clean Supply Order
for (int i = 0; i < supplyPoints.Count; i++)
{
supplyPoints[i].index = i;
}

//-------------------------------------------------------
//Setup Supply Order
//-------------------------------------------------------
Expand Down Expand Up @@ -595,6 +601,7 @@ void SetupSupplyPoints()
supplyOrderIndex = 0;

playerSupplyIndex = supplyOrderIndex;

playerSupplyID = supplyOrder[supplyOrderIndex];
break;
}
Expand Down Expand Up @@ -819,6 +826,14 @@ private void PlayerDeathEvent(bool killedSelf)
}
}

public void AddCustomSosig(Sosig sosig, bool isDefender = false)
{
sosigs.Add(sosig);

if (isDefender)
defenderSosigs.Add(sosig);
}

private IEnumerator ClearSosig(Sosig sosig)
{
// Wait for 5 seconds then splode the Sosig
Expand Down Expand Up @@ -965,6 +980,8 @@ public void CompleteGame()
void MovePanelsToLastSupply()
{
buyMenu.SetPositionAndRotation(LastSupplyPoint().buyMenu.position, LastSupplyPoint().buyMenu.rotation);
if (SR_BuyMenu.instance)
SR_BuyMenu.instance.UpdateBuyItems();

ammoStation.SetPositionAndRotation(LastSupplyPoint().ammoStation.position, LastSupplyPoint().ammoStation.rotation);

Expand Down Expand Up @@ -1055,6 +1072,8 @@ void CatchupPoints(int level)

public void SetLevel_Client(int totalCaptures, int attackSupply, int playerSupply, bool isEndless)
{
captureProtection = 10;

//New Player catchup
if (CurrentCaptures == 0 && totalCaptures >= 2)
{
Expand All @@ -1074,7 +1093,7 @@ public void SetLevel_Client(int totalCaptures, int attackSupply, int playerSuppl
attackSupplyID = attackSupply;
playerSupplyID = playerSupply;
inEndless = isEndless;

//Update Panels
MovePanelsToLastSupply();

Expand Down Expand Up @@ -1441,7 +1460,20 @@ private IEnumerator SetupDefenderSosigs(FactionLevel currentLevel)
int newGroup;
if (enemyCount > currentLevel.minPatrolSize)
{
newGroup = currentLevel.minPatrolSize + Random.Range(0, Mathf.CeilToInt(enemyCount / 3));
if (currentLevel.maxPatrolSize <= 0)
{
//Legacy
newGroup = currentLevel.minPatrolSize + Random.Range(0, Mathf.CeilToInt(enemyCount / 3));
}
else
{
//New maxPatrolSize
if (enemyCount >= currentLevel.maxPatrolSize)
newGroup = Random.Range(currentLevel.minPatrolSize, currentLevel.maxPatrolSize);
else
newGroup = Random.Range(currentLevel.minPatrolSize, enemyCount);
}

enemyCount -= newGroup;
}
else
Expand Down Expand Up @@ -1703,8 +1735,12 @@ void SpawnRabbitholeSosig(FactionLevel currentLevel)

Transform spawnPoint = AttackSupplyPoint().sosigSpawns[index];

Vector3 headPosition = GM.CurrentPlayerBody.Head.position + (GM.CurrentPlayerBody.Head.forward * 0.5f);
Vector3 spawnPosition = spawnPoint.position + (Vector3.up * 1.7f);
Vector3 scale = (spawnPoint.localScale * AttackSupplyPoint().spawnRadius) / 2;
spawnPosition.x += Random.Range(-scale.x, scale.x);
spawnPosition.z += Random.Range(-scale.z, scale.z);

Vector3 headPosition = GM.CurrentPlayerBody.Head.position + (GM.CurrentPlayerBody.Head.forward * 0.5f);

//Make sure the player isn't within range
if (SR_Global.Distance2D(headPosition, spawnPosition) >= AttackSupplyPoint().playerNearby)
Expand Down
2 changes: 1 addition & 1 deletion Packer-SupplyRaid/src/Plugin/src/Scripts/SR_ModLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public static List<SR_Profile> LoadProfiles()

if (directories.Count == 0)
{
Debug.LogError("Supply Raid: No profiles were found!");
Debug.Log("Supply Raid: No profiles were found!");
return null;
}

Expand Down
2 changes: 2 additions & 0 deletions Packer-SupplyRaid/src/Plugin/src/Scripts/SR_SosigFaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ public class FactionLevel
//PATROL
[Tooltip("The minimum size for Patrol Groups")]
public int minPatrolSize = 2;
[Tooltip("The minimum size for Patrol Groups")]
public int maxPatrolSize = -1;
[Tooltip("The sosig ID pool for patrols")]
public SosigPool patrolPool;

Expand Down
4 changes: 4 additions & 0 deletions Packer-SupplyRaid/src/Plugin/src/Scripts/SR_SupplyPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ void OnDrawGizmos()
Gizmos.DrawSphere(sosigSpawns[i].position + (Vector3.up * 0.125f), 0.25f);
Gizmos.DrawSphere(sosigSpawns[i].position + Vector3.up, 0.25f);
Gizmos.DrawSphere(sosigSpawns[i].position + (Vector3.up * 1.75f), 0.25f);

spawnSize = new Vector3(sosigSpawns[i].localScale.x * spawnRadius, 0.1f, sosigSpawns[i].localScale.z * spawnRadius);
Gizmos.matrix = Matrix4x4.TRS(sosigSpawns[i].position, Quaternion.identity, spawnSize);
Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
}
}

Expand Down
30 changes: 23 additions & 7 deletions Supply Raid Editor/Assets/Scenes/MainWindow.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,7 @@ MonoBehaviour:
subtractivePage: {fileID: 908485909}
itemThumbnail: {fileID: 228109505}
itemName: {fileID: 1875535184}
category: {fileID: 73254332}
minCapacity: {fileID: 2020881450}
maxCapacity: {fileID: 666424289}
minLevel: {fileID: 1675889555}
Expand Down Expand Up @@ -1704,6 +1705,17 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 1449082102283593548, guid: f997de2f3f2ba9249980488cee2fb333, type: 3}
m_PrefabInstance: {fileID: 59817993}
m_PrefabAsset: {fileID: 0}
--- !u!114 &73254332 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 1388294218989494939, guid: 4f55f7e74bc02cf48ad39b1bfc4ff7bd, type: 3}
m_PrefabInstance: {fileID: 1719332161}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &77710096
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -2644,7 +2656,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 7863198439538180566, guid: 97b9dc2bebf61134db42b05d197c1f57, type: 3}
propertyPath: m_Name
value: SubtractiveIDsTitle
value: RightPanelTitle
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 97b9dc2bebf61134db42b05d197c1f57, type: 3}
Expand Down Expand Up @@ -3164,7 +3176,7 @@ GameObject:
- component: {fileID: 147869625}
- component: {fileID: 147869624}
m_Layer: 5
m_Name: SubtractiveIDs
m_Name: RightPanel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand Down Expand Up @@ -7205,8 +7217,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 160, y: -138.28516}
m_SizeDelta: {x: 256.00003, y: 128}
m_AnchoredPosition: {x: 160, y: -126}
m_SizeDelta: {x: 256, y: 154}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &335566836
MonoBehaviour:
Expand Down Expand Up @@ -14756,6 +14768,7 @@ MonoBehaviour:
categoryPath:
itemCategory:
name: Item Category
category:
minCapacity: -1
maxCapacity: -1
minLevel: -1
Expand Down Expand Up @@ -14799,6 +14812,7 @@ MonoBehaviour:
lastCharacterDirectory:
lastFactionDirectory:
lastItemDirectory:
customSosigs: []
loadedCategories: []
debugLine: {fileID: 1621776299}
--- !u!4 &597142098
Expand Down Expand Up @@ -33707,7 +33721,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 6745787501110056088, guid: 97b9dc2bebf61134db42b05d197c1f57, type: 3}
propertyPath: m_AnchoredPosition.y
value: 24.00003
value: 24
objectReference: {fileID: 0}
- target: {fileID: 6745787501110056088, guid: 97b9dc2bebf61134db42b05d197c1f57, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
Expand Down Expand Up @@ -39846,15 +39860,15 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 501904701157035618, guid: 4f55f7e74bc02cf48ad39b1bfc4ff7bd, type: 3}
propertyPath: m_Name
value: NameTitle
value: CategoryTitle
objectReference: {fileID: 0}
- target: {fileID: 1615747631379591033, guid: 4f55f7e74bc02cf48ad39b1bfc4ff7bd, type: 3}
propertyPath: m_Text
value:
objectReference: {fileID: 0}
- target: {fileID: 3321160003226035055, guid: 4f55f7e74bc02cf48ad39b1bfc4ff7bd, type: 3}
propertyPath: m_Name
value: Name_InputField
value: Category_InputField
objectReference: {fileID: 0}
- target: {fileID: 3924173520416496428, guid: 4f55f7e74bc02cf48ad39b1bfc4ff7bd, type: 3}
propertyPath: m_AnchorMax.x
Expand Down Expand Up @@ -50987,6 +51001,7 @@ MonoBehaviour:
inputField: {fileID: 8961714464437032540}
category:
name:
category:
minCapacity: -1
maxCapacity: -1
minLevel: -1
Expand Down Expand Up @@ -51152,6 +51167,7 @@ MonoBehaviour:
inputField: {fileID: 8961714463327741242}
category:
name:
category:
minCapacity: -1
maxCapacity: -1
minLevel: -1
Expand Down
1 change: 1 addition & 0 deletions Supply Raid Editor/Assets/Scripts/Data/SR_ItemCategory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Supply_Raid_Editor
public class SR_ItemCategory
{
public string name;
public string category = "";

[Tooltip("Magazine/Clip Min Capacity for this loot table")]
public int minCapacity = -1;
Expand Down
6 changes: 5 additions & 1 deletion Supply Raid Editor/Assets/Scripts/DataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public Sprite LoadSprite(string path)
{
Texture2D tex = null;

//Clean path
path = Path.GetFullPath(path);
path = path.Replace("%20", " ");

byte[] fileData;

if (File.Exists(path) && tex == null)
Expand Down Expand Up @@ -228,8 +232,8 @@ private IEnumerator OutputRoutine(string url, JSONTypeEnum loadType)
LoadFaction(loader.text);
yield return null;
MenuManager.instance.factionLoaded = true;
MenuManager.instance.OpenFactionPanel();
FactionUI.instance.LoadFaction();
MenuManager.instance.OpenFactionPanel();

url = url.Remove(url.Length - 4) + "png";
url = url.Remove(0, 8);
Expand Down
7 changes: 7 additions & 0 deletions Supply Raid Editor/Assets/Scripts/ItemCategoryUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class ItemCategoryUI : MonoBehaviour
[Header("Input Fields")]
public Image itemThumbnail;
public InputField itemName;
public InputField category;
public InputField minCapacity;
public InputField maxCapacity;
public InputField minLevel;
Expand Down Expand Up @@ -113,6 +114,9 @@ public void UpdateItemCategory()
//Name
item.name = itemName.text;

//Category
item.category = category.text;

//Capacity
item.minCapacity = int.Parse(minCapacity.text);
item.maxCapacity = int.Parse(maxCapacity.text);
Expand Down Expand Up @@ -277,6 +281,9 @@ public void UpdateUI()
//Name
itemName.text = item.name;

//Category
category.text = item.category;

//Capacity
minCapacity.text = item.minCapacity.ToString();
maxCapacity.text = item.maxCapacity.ToString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ MonoBehaviour:
m_EditorClassIdentifier:
PackageName: SupplyRaidExample
Author: Packer
Version: 1.2.0
Version: 1.2.1
Icon: {fileID: 2800000, guid: faa5af54481d5a74085e3764f0b080ba, type: 3}
ReadMe: {fileID: 102900000, guid: 3634afcb0e997034ab39e6154341f430, type: 3}
WebsiteURL:
Description: An example scene of the gamemode Supply Raid
AdditionalDependencies:
- VIP-H3MP-1.8.0
- Packer-SupplyRaid-1.2.0
- nrgill28-HookGenPatcher_H3VR-1.2.3
- Packer-SupplyRaid-1.2.0
StripNamespaces: 1
AdditionalNamespaces:
- H3MP
Expand Down

0 comments on commit 41aa55e

Please sign in to comment.