Skip to content

Commit

Permalink
v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pdcook committed Jul 14, 2021
1 parent 7fcf1cd commit 33b40f9
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 56 deletions.
Binary file modified PCE.dll
Binary file not shown.
99 changes: 47 additions & 52 deletions PCE/Cards/LaserCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, Characte
objectsToSpawn.Add(laserGun);

gun.objectsToSpawn = objectsToSpawn.ToArray();

gun.reloadTime += 0.5f;
gun.attackSpeed *= 2f;
}
public override void OnRemoveCard()
{
Expand Down Expand Up @@ -62,41 +65,20 @@ protected override CardInfoStat[] GetStats()
{
return new CardInfoStat[]
{
new CardInfoStat
{
positive = true,
stat = "Bullets",
amount = "Light",
simepleAmount = CardInfoStat.SimpleAmount.notAssigned
},
new CardInfoStat
{
positive = true,
stat = "Bullet Speed",
amount = "+10000%",
simepleAmount = CardInfoStat.SimpleAmount.aHugeAmountOf
},
new CardInfoStat
{
positive = false,
stat = "Damage",
amount = "-99%",
simepleAmount = CardInfoStat.SimpleAmount.aLotLower
},
new CardInfoStat
{
positive = false,
stat = "Reload Time",
amount = "+50%",
simepleAmount = CardInfoStat.SimpleAmount.aLotLower
simepleAmount = CardInfoStat.SimpleAmount.aLotOf
},
new CardInfoStat
{
positive = false,
stat = "Ammo",
amount = "1",
simepleAmount = CardInfoStat.SimpleAmount.notAssigned
},
positive = false,
stat = "Attack Speed",
amount = "-50%",
simepleAmount = CardInfoStat.SimpleAmount.lower
}
};
}
protected override CardThemeColor.CardThemeColorType GetTheme()
Expand Down Expand Up @@ -133,7 +115,7 @@ void Start()

//Destroy(gameObject, 1f);

if (!PhotonNetwork.OfflineMode && !PhotonNetwork.IsMasterClient) return;
if (!PhotonNetwork.OfflineMode && !this.gameObject.transform.parent.GetComponent<ProjectileHit>().ownPlayer.data.view.IsMine) return;

//this.ExecuteAfterSeconds(0.5f, () =>
//{
Expand All @@ -158,7 +140,7 @@ public class LaserGun : MonoBehaviour, IPunInstantiateMagicCallback
private Player player;
public void OnPhotonInstantiate(Photon.Pun.PhotonMessageInfo info)
{
UnityEngine.Debug.Log("LASERGUN: ONPHOTONINSTANTIATE");
//UnityEngine.Debug.Log("LASERGUN: ONPHOTONINSTANTIATE");

object[] instantiationData = info.photonView.InstantiationData;

Expand Down Expand Up @@ -321,15 +303,15 @@ void Start()
}
Destroy(gameObject, 1f);

if (!PhotonNetwork.OfflineMode && !PhotonNetwork.IsMasterClient) return;
if (!PhotonNetwork.OfflineMode && !this.transform.parent.GetComponent<PhotonView>().IsMine) return;

if (this.gameObject.transform.parent == null)
{
UnityEngine.Debug.Log("NO PARENT");
if (this.gameObject.GetComponent<ProjectileHit>() == null)
{
UnityEngine.Debug.Log("NO PROJECTILE");
}
//UnityEngine.Debug.Log("NO PARENT");
//if (this.gameObject.GetComponent<ProjectileHit>() == null)
//{
// UnityEngine.Debug.Log("NO PROJECTILE");
//}
}

//this.ExecuteAfterSeconds(0.1f, () =>
Expand Down Expand Up @@ -380,7 +362,7 @@ class LaserHurtbox : MonoBehaviour, IPunInstantiateMagicCallback

public float duration;
private readonly float[] minmaxwidth = new float[]{0.1f,0.5f};
private readonly float baseDamageMultiplier = 2f;
private readonly float baseDamageMultiplier = 1f;

private LineRenderer trail;
private readonly int MAX = 100000;
Expand Down Expand Up @@ -429,13 +411,13 @@ private float intensity
}
public void OnPhotonInstantiate(Photon.Pun.PhotonMessageInfo info)
{
UnityEngine.Debug.Log("ONPHOTONINSTANTIATE");
//UnityEngine.Debug.Log("ONPHOTONINSTANTIATE");

object[] instantiationData = info.photonView.InstantiationData;

GameObject parent = PhotonView.Find((int)instantiationData[0]).gameObject;

if (PhotonNetwork.OfflineMode || PhotonNetwork.IsMasterClient)
if (PhotonNetwork.OfflineMode || this.GetComponent<PhotonView>().IsMine)//PhotonNetwork.IsMasterClient)
{
this.gameObject.transform.SetParent(parent.transform);

Expand Down Expand Up @@ -467,14 +449,9 @@ public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
void Destroy()
{
//UnityEngine.GameObject.Destroy(this.gameObject.transform.parent.gameObject);
if (PhotonNetwork.OfflineMode || PhotonNetwork.IsMasterClient) { PhotonNetwork.Destroy(this.gameObject.GetComponent<PhotonView>()); }
if (PhotonNetwork.OfflineMode || this.gameObject.GetComponent<PhotonView>().IsMine) { PhotonNetwork.Destroy(this.gameObject.GetComponent<PhotonView>()); }
Destroy(this.gameObject);
}
/*
void OnDestroy()
{
this.GetComponent<PhotonView>().Synchronization = ViewSynchronization.Off;
this.GetComponent<PhotonView>().ObservedComponents.Remove(this);
}*/

void Awake()
{
Expand Down Expand Up @@ -544,13 +521,14 @@ void Update()
this.frames++;
return;
}
else
else if (this.gameObject.GetComponent<PhotonView>().IsMine)
{
this.frames = 0;
this.numPos = this.trail.GetPositions(positions3d);
//this.SyncTrail();
this.UpdateDamage();
this.UpdateColor();
this.UpdateWidth();
this.HurtBox(positions3d.toVector2Array().ToList<Vector2>().Take(this.numPos).ToArray());
}

Expand Down Expand Up @@ -581,7 +559,7 @@ void UpdateDamage()
}
void UpdateColor()
{
this.color = new Color(this.color.r, this.color.g, this.color.b, UnityEngine.Mathf.Clamp(this.color.a * this.intensity, 0.25f, 1f));
this.color = new Color(this.color.r, this.color.g, this.color.b, UnityEngine.Mathf.Clamp(this.color.a * this.intensity, 0f, 1f));
}
void UpdateWidth()
{
Expand All @@ -607,9 +585,9 @@ void HurtBox(Vector2[] vertices)
BindingFlags.NonPublic, null, this.gun, new object[] { }))
{

UnityEngine.Debug.Log("baseDamage: " + this.baseDamage.ToString());
UnityEngine.Debug.Log("damageMult: " + this.damageMultiplier.ToString());
UnityEngine.Debug.Log("Intensity: " + this.intensity.ToString());
//UnityEngine.Debug.Log("baseDamage: " + this.baseDamage.ToString());
//UnityEngine.Debug.Log("damageMult: " + this.damageMultiplier.ToString());
//UnityEngine.Debug.Log("Intensity: " + this.intensity.ToString());


componentInParent.CallTakeDamage(base.transform.forward * this.baseDamage * this.damageMultiplier, collider.transform.position, this.gun.gameObject, this.player, true);
Expand Down Expand Up @@ -703,6 +681,10 @@ void Update()
{
this.SyncTrail();
}
else if ((this.frameCount > this.initialDelay) && (this.syncRate == 0 || this.frameCount % this.syncRate == 0))
{
this.SyncAppearance();
}

}
bool BulletClose()
Expand All @@ -713,7 +695,7 @@ bool BulletClose()
}
void SyncTrail()
{
if (!PhotonNetwork.OfflineMode && PhotonNetwork.IsMasterClient)
if (!PhotonNetwork.OfflineMode && this.gameObject.GetComponent<PhotonView>().IsMine)//PhotonNetwork.IsMasterClient)
{
this.view.RPC("RPCA_SyncTrail", RpcTarget.Others, new object[] { this.positions3d.toVector2Array().ToList().Take(this.numPos).ToArray(), this.numPos, this.line.startWidth, this.line.startColor.r, this.line.startColor.g, this.line.startColor.b, this.line.startColor.a });
}
Expand All @@ -723,7 +705,7 @@ void RPCA_SyncTrail(Vector2[] positions, int num, float width, float r, float g,
{
// unparent once the host starts syncing the position
if (this.gameObject.transform.parent != null) { this.gameObject.transform.SetParent(null); }
UnityEngine.Debug.Log("SYNC");
//UnityEngine.Debug.Log("SYNC");
this.line.positionCount = num;
this.line.SetPositions(positions.toVector3Array());
this.numPos = this.line.GetPositions(this.positions3d);
Expand All @@ -732,7 +714,20 @@ void RPCA_SyncTrail(Vector2[] positions, int num, float width, float r, float g,
this.color = new Color(r, g, b, a);

}
void SyncAppearance()
{
if (!PhotonNetwork.OfflineMode && this.gameObject.GetComponent<PhotonView>().IsMine)//PhotonNetwork.IsMasterClient)
{
this.view.RPC("RPCA_SyncAppearance", RpcTarget.Others, new object[] { this.line.startWidth, this.line.startColor.r, this.line.startColor.g, this.line.startColor.b, this.line.startColor.a });
}
}
[PunRPC]
void RPCA_SyncAppearance(float width, float r, float g, float b, float a)
{
this.width = width;
this.color = new Color(r, g, b, a);

}

}
}
9 changes: 8 additions & 1 deletion PCE/PCE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace PCE
[BepInDependency("pykess.rounds.plugins.legraycasterspatch", BepInDependency.DependencyFlags.HardDependency)] // fixes physics for small players
[BepInDependency("pykess.rounds.plugins.cardchoicespawnuniquecardpatch", BepInDependency.DependencyFlags.HardDependency)] // fixes allowMultiple and blacklistedCategories
[BepInDependency("pykess.rounds.plugins.gununblockablepatch", BepInDependency.DependencyFlags.HardDependency)] // fixes gun.unblockable
[BepInPlugin(ModId, ModName, "0.2.0.3")]
[BepInPlugin(ModId, ModName, "0.2.1.0")]
[BepInProcess("Rounds.exe")]
public class PCE : BaseUnityPlugin
{
Expand Down Expand Up @@ -121,6 +121,13 @@ private IEnumerator ResetEffectsBetweenBattles()
{
CustomEffects.ClearAllReversibleEffects(players[j].gameObject);
}
foreach (GameObject gameObject in FindObjectsOfType(typeof(GameObject)) as GameObject[])
{
if (gameObject.name == "LaserTrail(Clone)")
{
UnityEngine.GameObject.Destroy(gameObject);
}
}
yield break;
}

Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,22 @@ Download [r2modman](https://rounds.thunderstore.io/package/ebkr/r2modman/), set

2. Install the *newest versions* of [UnboundLib and MMHOOK](https://github.com/Rounds-Modding/UnboundLib/releases).

3. Install `PlayerJumpPatch` which you can find [here](https://rounds.thunderstore.io/package/Pykess/PlayerJumpPatch/).
3. Install all other dependencies, which are listed [here](https://rounds.thunderstore.io/package/Pykess/PCE/).

4. Copy `PCE.dll` to `/path/to/Steam/steamapps/common/ROUNDS/BepInEx/plugins/`

### Version Notes
-----------------

#### v0.2.1.0
-------------

- Laser has returned! And hopefully works.
- A few hopefully small known issues:
- After main-menuing, laser no longer works
- Laser does not work while the Rain/Wall/Nuke effects from Demonic possession are active
- Using the new version of Unbound, cards now say PCE in the bottom left

#### v0.2.0.3
-------------

Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "PCE",
"version_number": "2.0.3",
"version_number": "2.1.0",
"website_url": "https://github.com/pdcook/PCE",
"description": "Adds a number of new cards to the game",
"dependencies": [
"Pykess-CardChoiceSpawnUniqueCardPatch-0.0.0",
"Pykess-PlayerJumpPatch-0.0.2",
"Pykess-LegRaycastersPatch-0.0.0",
"Pykess-GunUnblockablePatch-0.0.0",
"willis81808-UnboundLib-2.2.0",
"willis81808-UnboundLib-2.2.1",
"willis81808-MMHook-1.0.0",
"BepInEx-BepInExPack_ROUNDS-5.4.1100"
]
Expand Down

0 comments on commit 33b40f9

Please sign in to comment.