Skip to content

Commit c5b7cc9

Browse files
authored
Merge branch 'Facepunch:master' into fromhost_fix
2 parents f04f84d + 22dc5b1 commit c5b7cc9

File tree

114 files changed

+4532
-1135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+4532
-1135
lines changed

.github/workflows/pull_request.yml

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,48 @@ jobs:
88
runs-on: ubuntu-latest
99
if: github.event.label.name == 'triaged'
1010
steps:
11+
- name: Ensure PR checks passed
12+
uses: actions/github-script@v7
13+
with:
14+
github-token: ${{ secrets.GITHUB_TOKEN }}
15+
script: |
16+
const requiredChecks = ['format', 'tests'];
17+
18+
const pr = context.payload.pull_request;
19+
if (!pr) {
20+
throw new Error('No pull request found in event payload.');
21+
}
22+
23+
const { data } = await github.rest.checks.listForRef({
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
ref: pr.head.sha,
27+
per_page: 100
28+
});
29+
30+
const checkRuns = data.check_runs ?? [];
31+
for (const requiredCheck of requiredChecks) {
32+
const match = checkRuns.find(run => (run.name ?? '') === requiredCheck);
33+
34+
if (!match || match.conclusion !== 'success') {
35+
const status = match ? (match.conclusion ?? match.status ?? 'unknown') : 'missing';
36+
core.warning(`Required check '${requiredCheck}' did not pass (${status}).`);
37+
throw new Error('Cannot triage until required checks succeed. Remove and re-add the triaged label to retry.');
38+
}
39+
}
40+
1141
- name: Repository Dispatch
12-
uses: peter-evans/repository-dispatch@v4
42+
uses: actions/github-script@v7
43+
env:
44+
DISPATCH_CONTEXT: ${{ toJson(github) }}
1345
with:
14-
token: ${{ secrets.SBOXBOT_TOKEN }}
15-
repository: Facepunch/sbox
16-
event-type: pr-triaged
17-
client-payload: '{"github": ${{ toJson(github) }}}'
46+
github-token: ${{ secrets.SBOXBOT_TOKEN }}
47+
script: |
48+
const clientPayload = JSON.parse(process.env.DISPATCH_CONTEXT);
49+
50+
await github.rest.repos.createDispatchEvent({
51+
owner: 'Facepunch',
52+
repo: 'sbox',
53+
event_type: 'pr-triaged',
54+
client_payload: { github: clientPayload }
55+
});

.github/workflows/pull_request_checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Pull Request Checks
1+
name: Tests
22

33
on:
44
pull_request:
@@ -8,7 +8,7 @@ permissions:
88
contents: read
99

1010
jobs:
11-
format:
11+
tests:
1212
runs-on: [ windows-latest ]
1313
steps:
1414
- name: Full Checkout
File renamed without changes.

engine/Definitions/common/Physics/IPhysicsJoint.def

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,43 @@ native class IPhysicsJoint as NativeEngine.IPhysicsJoint
7979
float Motor_GetAngularDampingRatio();
8080
float Motor_GetMaxSpringForce();
8181
float Motor_GetMaxSpringTorque();
82+
83+
void Wheel_EnableSuspension( bool flag );
84+
bool Wheel_IsSuspensionEnabled();
85+
void Wheel_SetSuspensionHertz( float hertz );
86+
float Wheel_GetSuspensionHertz();
87+
void Wheel_SetSuspensionDampingRatio( float dampingRatio );
88+
float Wheel_GetSuspensionDampingRatio();
89+
void Wheel_EnableSuspensionLimit( bool flag );
90+
bool Wheel_IsSuspensionLimitEnabled();
91+
float Wheel_GetLowerSuspensionLimit();
92+
float Wheel_GetUpperSuspensionLimit();
93+
void Wheel_SetSuspensionLimits( float lower, float upper );
94+
void Wheel_EnableSpinMotor( bool flag );
95+
bool Wheel_IsSpinMotorEnabled();
96+
void Wheel_SetSpinMotorSpeed( float speed );
97+
float Wheel_GetSpinMotorSpeed();
98+
void Wheel_SetMaxSpinTorque( float torque );
99+
float Wheel_GetMaxSpinTorque();
100+
void Wheel_EnableSteering( bool flag );
101+
bool Wheel_IsSteeringEnabled();
102+
void Wheel_SetSteeringHertz( float hertz );
103+
float Wheel_GetSteeringHertz();
104+
void Wheel_SetSteeringDampingRatio( float dampingRatio );
105+
float Wheel_GetSteeringDampingRatio();
106+
void Wheel_SetMaxSteeringTorque( float torque );
107+
float Wheel_GetMaxSteeringTorque();
108+
void Wheel_EnableSteeringLimit( bool flag );
109+
bool Wheel_IsSteeringLimitEnabled();
110+
float Wheel_GetLowerSteeringLimit();
111+
float Wheel_GetUpperSteeringLimit();
112+
void Wheel_SetSteeringLimits( float lowerRadians, float upperRadians );
113+
void Wheel_SetTargetSteeringAngle( float radians );
114+
float Wheel_GetTargetSteeringAngle();
115+
float Wheel_GetSpinSpeed();
116+
float Wheel_GetSpinTorque();
117+
float Wheel_GetSteeringAngle();
118+
float Wheel_GetSteeringTorque();
82119
}
83120

84121
managed static class Sandbox.Physics.PhysicsEngine

engine/Definitions/common/Physics/IPhysicsWorld.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ native class IPhysicsWorld
4343
IPhysicsJoint AddPrismaticJoint( IPhysicsBody pBody1, IPhysicsBody pBody2, Transform localFrame1, Transform localFrame2 );
4444
IPhysicsJoint AddSphericalJoint( IPhysicsBody pBody1, IPhysicsBody pBody2, Transform localFrame1, Transform localFrame2 );
4545
IPhysicsJoint AddMotorJoint( IPhysicsBody pBody1, IPhysicsBody pBody2, Transform localFrame1, Transform localFrame2 );
46+
IPhysicsJoint AddWheelJoint( IPhysicsBody pBody1, IPhysicsBody pBody2, Transform localFrame1, Transform localFrame2 );
4647

4748
//
4849
// Sets the collision rules using a json serialized Sandbox.Internal.CollisionRules

engine/Definitions/engine/engine.globals.def

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,6 @@ native static class global as NativeEngine.EngineGlobal
6666
bool SourceEngineFrame( CMaterialSystem2AppSystemDict appDict, double currentTime, double previousTime );
6767
void SourceEngineShutdown( CMaterialSystem2AppSystemDict appDict, bool forced );
6868

69-
inline void UpdateWindowSize()
70-
{
71-
VideoModeChange_t* pModeChange = g_pEngineServiceMgr->GetVideoModeChange();
72-
if ( pModeChange )
73-
{
74-
g_pRenderService->SetVideoMode( pModeChange->m_deviceInfo );
75-
pModeChange->ModeChangeComplete();
76-
}
77-
78-
SwapChainHandle_t m_hSwapChain = g_pEngineServiceMgr->GetEngineSwapChain();
79-
RenderViewport_t renderViewport;
80-
renderViewport.Init( 0, 0, 512, 512, 0, 1 );
81-
82-
CRenderContextPtr pRenderContext( g_pRenderDevice, RenderTargetDesc_t( m_hSwapChain, RENDER_SRGB ), "Clear" );
83-
pRenderContext->Clear( Vector4D( 0, 0, 0, 0 ) );
84-
pRenderContext->SetViewports( 1, &renderViewport );
85-
86-
pRenderContext->Submit();
87-
g_pRenderDevice->Present( m_hSwapChain );
88-
}
89-
9069
inline float GetDiagonalDpi()
9170
{
9271
return Plat_GetDPI();

engine/Sandbox.Access/Rules/BaseAccess.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ internal static partial class Rules
1818
"System.Private.CoreLib/System.Collections.*",
1919
"System.Collections/System.Collections.*",
2020
"System.Collections.Immutable/System.Collections.Immutable.*",
21+
"System.Collections.Immutable/System.Collections.Frozen.*",
2122
"System.Collections.Immutable/System.Linq.ImmutableArrayExtensions.*",
2223
"System.ObjectModel/System.Collections.ObjectModel.*",
2324
"System.ObjectModel/System.Collections.Specialized.*",

engine/Sandbox.Engine/Core/Interop/Handle.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ internal static int RegisterHandle( IntPtr ptr, uint type )
136136
if ( type == Types.PhysicsSphericalJoint ) return New( ptr, ( h ) => new Sandbox.Physics.BallSocketJoint( h ) );
137137
if ( type == Types.PhysicsPulleyJoint ) return New( ptr, ( h ) => new Sandbox.Physics.PulleyJoint( h ) );
138138
if ( type == Types.PhysicsMotorJoint ) return New( ptr, ( h ) => new Sandbox.Physics.ControlJoint( h ) );
139+
if ( type == Types.PhysicsWheelJoint ) return New( ptr, ( h ) => new Sandbox.Physics.WheelJoint( h ) );
139140
if ( type == Types.PhysicsJoint ) return New( ptr, ( h ) => new Sandbox.Physics.PhysicsJoint( h ) );
140141

141142
if ( type == Types.PhysicsConicalJoint ) return New( ptr, ( h ) => new Sandbox.Physics.PhysicsJoint( h ) );
@@ -193,6 +194,7 @@ static class Types
193194
internal static uint PhysicsPrismaticJoint { get; } = StringToken.FindOrCreate( "PhysicsPrismaticJoint" );
194195
internal static uint PhysicsConicalJoint { get; } = StringToken.FindOrCreate( "PhysicsConicalJoint" );
195196
internal static uint PhysicsMotorJoint { get; } = StringToken.FindOrCreate( "PhysicsMotorJoint" );
197+
internal static uint PhysicsWheelJoint { get; } = StringToken.FindOrCreate( "PhysicsWheelJoint" );
196198
internal static uint PhysicsPulleyJoint { get; } = StringToken.FindOrCreate( "PhysicsPulleyJoint" );
197199
internal static uint PhysicsGenericJoint { get; } = StringToken.FindOrCreate( "PhysicsGenericJoint" );
198200
internal static uint PhysicsNullJoint { get; } = StringToken.FindOrCreate( "PhysicsNullJoint" );

engine/Sandbox.Engine/Sandbox.Engine.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="10.0.0" />
4545
<PackageReference Include="Svg.Skia" Version="2.0.0.4" />
4646
<PackageReference Include="Azure.Messaging.WebPubSub.Client" Version="1.0.0" />
47+
<PackageReference Include="System.Numerics.Tensors" Version="10.0.0" />
4748
</ItemGroup>
4849

4950
<ItemGroup>

engine/Sandbox.Engine/Scene/Components/Collider/Rigidbody.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ internal void HandleImpactDamage( Collision collision )
332332
if ( !EnableImpactDamage ) return;
333333
if ( IsProxy ) return;
334334

335-
var speed = collision.Contact.Speed.Length;
335+
var speed = collision.Contact.NormalSpeed;
336336
var minSpeed = MinImpactDamageSpeed;
337337
if ( minSpeed <= 0 )
338338
minSpeed = 500f;
@@ -477,10 +477,23 @@ internal void UpdateTransformFromBody()
477477
/// </summary>
478478
internal Transform? TargetTransform { get; set; }
479479

480+
/// <summary>
481+
/// Linear velocity before physics step. Internal until someone needs them.
482+
/// </summary>
483+
internal Vector3 PreVelocity { get; private set; }
484+
485+
/// <summary>
486+
/// Angular velocity before physics step. Internal until someone needs them.
487+
/// </summary>
488+
internal Vector3 PreAngularVelocity { get; private set; }
489+
480490
void IScenePhysicsEvents.PrePhysicsStep()
481491
{
482492
if ( !_body.IsValid() ) return;
483493

494+
PreVelocity = _body.Velocity;
495+
PreAngularVelocity = _body.AngularVelocity;
496+
484497
if ( TargetTransform.HasValue )
485498
{
486499
// Editor transform uses velocity to move.

0 commit comments

Comments
 (0)