Skip to content
Open

Lancer #1019

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 89795172, guid: 951ce57ad999ac1f040a4dceb5f8b763, type: 3}
m_Name: escDodge
m_EditorClassIdentifier:
targetType:
assemblyQualifiedName: EntityStates.Lancer.Dodge, Starstorm2, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
serializedFieldsCollection:
serializedFields:
- fieldName: duration
fieldValue:
stringValue: 0.5
objectValue: {fileID: 0}
- fieldName: initialSpeedCoefficient
fieldValue:
stringValue: 6.5
objectValue: {fileID: 0}
- fieldName: finalSpeedCoefficient
fieldValue:
stringValue: 1.5
objectValue: {fileID: 0}
- fieldName: dodgeFOV
fieldValue:
stringValue: -1
objectValue: {fileID: 0}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 89795172, guid: 951ce57ad999ac1f040a4dceb5f8b763, type: 3}
m_Name: escIonDetonation
m_EditorClassIdentifier:
targetType:
assemblyQualifiedName: EntityStates.Lancer.IonDetonation, Starstorm2, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
serializedFieldsCollection:
serializedFields:
- fieldName: baseDuration
fieldValue:
stringValue: 1
objectValue: {fileID: 0}
- fieldName: novaDamageCoefficient
fieldValue:
stringValue: 8
objectValue: {fileID: 0}
- fieldName: novaRadius
fieldValue:
stringValue: 12
objectValue: {fileID: 0}
- fieldName: novaForce
fieldValue:
stringValue: 2000
objectValue: {fileID: 0}
- fieldName: novaProcCoefficient
fieldValue:
stringValue: 1
objectValue: {fileID: 0}
- fieldName: novaSoundString
fieldValue:
stringValue:
objectValue: {fileID: 0}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 89795172, guid: 951ce57ad999ac1f040a4dceb5f8b763, type: 3}
m_Name: escIonFistPunch
m_EditorClassIdentifier:
targetType:
assemblyQualifiedName: EntityStates.Lancer.IonFistPunch, Starstorm2, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
serializedFieldsCollection:
serializedFields:
- fieldName: baseDuration
fieldValue:
stringValue: 0.4
objectValue: {fileID: 0}
- fieldName: damageCoefficient
fieldValue:
stringValue: 1.5
objectValue: {fileID: 0}
- fieldName: force
fieldValue:
stringValue: 20
objectValue: {fileID: 0}
- fieldName: procCoefficient
fieldValue:
stringValue: 1
objectValue: {fileID: 0}
- fieldName: attackSoundString
fieldValue:
stringValue:
objectValue: {fileID: 0}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 89795172, guid: 951ce57ad999ac1f040a4dceb5f8b763, type: 3}
m_Name: escRecallSpear
m_EditorClassIdentifier:
targetType:
assemblyQualifiedName: EntityStates.Lancer.RecallSpear, Starstorm2, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
serializedFieldsCollection:
serializedFields:
- fieldName: baseDuration
fieldValue:
stringValue: 0.3
objectValue: {fileID: 0}
- fieldName: recallSoundString
fieldValue:
stringValue:
objectValue: {fileID: 0}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 89795172, guid: 951ce57ad999ac1f040a4dceb5f8b763, type: 3}
m_Name: escSpearThrust
m_EditorClassIdentifier:
targetType:
assemblyQualifiedName: EntityStates.Lancer.SpearThrust, Starstorm2, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
serializedFieldsCollection:
serializedFields:
- fieldName: hitboxGroupName
fieldValue:
stringValue: SpearHitbox
objectValue: {fileID: 0}
- fieldName: damageCoefficient
fieldValue:
stringValue: 3.5
objectValue: {fileID: 0}
- fieldName: procCoefficient
fieldValue:
stringValue: 1
objectValue: {fileID: 0}
- fieldName: baseDuration
fieldValue:
stringValue: 0.9
objectValue: {fileID: 0}
- fieldName: attackStartTimeFraction
fieldValue:
stringValue: 0.25
objectValue: {fileID: 0}
- fieldName: attackEndTimeFraction
fieldValue:
stringValue: 0.45
objectValue: {fileID: 0}
- fieldName: earlyExitTimeFraction
fieldValue:
stringValue: 0.6
objectValue: {fileID: 0}
- fieldName: pushForce
fieldValue:
stringValue: 300
objectValue: {fileID: 0}
- fieldName: hitStopDuration
fieldValue:
stringValue: 0.08
objectValue: {fileID: 0}
- fieldName: hitHopVelocity
fieldValue:
stringValue: 4
objectValue: {fileID: 0}
- fieldName: attackRecoil
fieldValue:
stringValue: 0.75
objectValue: {fileID: 0}
- fieldName: muzzleString
fieldValue:
stringValue: SpearMuzzle
objectValue: {fileID: 0}
- fieldName: playbackRateParam
fieldValue:
stringValue: Primary.playbackRate
objectValue: {fileID: 0}
- fieldName: damageType
fieldValue:
stringValue: '{"assemblyQualifiedName":"RoR2.DamageType, RoR2, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null","values":"Generic"}'
objectValue: {fileID: 0}
- fieldName: tipperDamageCoefficient
fieldValue:
stringValue: 2
objectValue: {fileID: 0}
- fieldName: thrustAnimationState
fieldValue:
stringValue: SpearThrust
objectValue: {fileID: 0}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 89795172, guid: 951ce57ad999ac1f040a4dceb5f8b763, type: 3}
m_Name: escThrowSpear
m_EditorClassIdentifier:
targetType:
assemblyQualifiedName: EntityStates.Lancer.ThrowSpear, Starstorm2, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
serializedFieldsCollection:
serializedFields:
- fieldName: baseDuration
fieldValue:
stringValue: 0.5
objectValue: {fileID: 0}
- fieldName: damageCoefficient
fieldValue:
stringValue: 4
objectValue: {fileID: 0}
- fieldName: force
fieldValue:
stringValue: 40
objectValue: {fileID: 0}
- fieldName: procCoefficient
fieldValue:
stringValue: 1
objectValue: {fileID: 0}
- fieldName: throwSoundString
fieldValue:
stringValue:
objectValue: {fileID: 0}
- fieldName: muzzleString
fieldValue:
stringValue: SpearMuzzle
objectValue: {fileID: 0}
18 changes: 18 additions & 0 deletions SS2-Project/Assets/Starstorm2/Components/Duke/DukeController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using RoR2;
using UnityEngine;
using UnityEngine.Networking;

namespace SS2.Components
{
[RequireComponent(typeof(CharacterBody))]
public class DukeController : NetworkBehaviour
{
public bool useAltCamera;

private void Awake()
{
// TODO Make it configurable
useAltCamera = false;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
using UnityEngine;
using RoR2;

namespace SS2.Components
{
/// <summary>
/// Receives incoming damage on a GupBall body and converts it into a constant-velocity kick
/// in the direction away from the attacker. Damage is always rejected so the ball never dies.
///
/// Implements IOnIncomingDamageServerReceiver (not IOnTakeDamageServerReceiver) because:
/// - It fires before damage is applied (HealthComponent.cs:1318)
/// - We can set damageInfo.rejected = true to prevent all damage
/// - godMode would block ALL hooks, so we use rejection instead
///
/// Networking: This hook runs server-only inside HealthComponent.TakeDamage [Server].
/// The ball body is server-authoritative (no player owner), so ApplyForceImpulse
/// applies directly. CharacterNetworkTransform syncs position to clients.
/// </summary>
public class GupBallKickReceiver : MonoBehaviour, IOnIncomingDamageServerReceiver
{
[Header("Kick Settings")]
public float kickSpeed = 30f;
public float maxSpeed = 60f;
[Tooltip("Multiplier for vertical kick component. Lower = flatter kicks.")]
public float verticalKickMultiplier = 0.6f;
[Tooltip("Upward bias added to every kick so ground-level hits arc slightly.")]
public float upwardBias = 0.1f;

private CharacterBody body;
private CharacterMotor motor;

private void Awake()
{
if (!TryGetComponent(out body))
{
Debug.LogError("GupBallKickReceiver: Missing CharacterBody on " + gameObject.name);
}
if (!TryGetComponent(out motor))
{
Debug.LogError("GupBallKickReceiver: Missing CharacterMotor on " + gameObject.name);
}
}

public void OnIncomingDamageServer(DamageInfo damageInfo)
{
damageInfo.rejected = true;

if (motor == null || body == null)
return;

if (damageInfo.attacker == null)
return;

CharacterBody attackerBody;
if (!damageInfo.attacker.TryGetComponent(out attackerBody))
return;

Vector3 ballPosition = body.corePosition;
Vector3 attackerPosition = attackerBody.corePosition;
Vector3 kickDir = ballPosition - attackerPosition;

// Epsilon check: attacker overlapping the ball
if (kickDir.sqrMagnitude < 0.001f)
{
kickDir = Vector3.up;
}
else
{
kickDir.Normalize();
}

// Dampen vertical component
kickDir.y *= verticalKickMultiplier;

// Add upward bias so ground-level hits arc
kickDir.y += upwardBias;

kickDir.Normalize();

Vector3 kickForce = kickDir * kickSpeed;

PhysForceInfo forceInfo = PhysForceInfo.Create();
forceInfo.force = kickForce;
forceInfo.massIsOne = true;
forceInfo.ignoreGroundStick = true;
forceInfo.resetVelocity = true;
motor.ApplyForceImpulse(in forceInfo);

// Safety clamp
if (motor.velocity.sqrMagnitude > maxSpeed * maxSpeed)
{
motor.velocity = motor.velocity.normalized * maxSpeed;
}
}
}
}
Loading