Physics (#3452)
* Content side new physics structure * BroadPhase outline done * But we need to fix WorldAABB * Fix static pvs AABB * Fix import * Rando fixes * B is for balloon * Change human mob hitbox to circle * Decent movement * Start adding friction to player controller I think it's the best way to go about it to keep other objects somewhat consistent for physics. * This baby can fit so many physics bugs in it. * Slight mob mover optimisations. * Player mover kinda works okay. * Beginnings of testbed * More testbed * Circlestack bed * Namespaces * BB fixes * Pull WorldAABB * Joint pulling * Semi-decent movement I guess. * Pulling better * Bullet controller + old movement * im too dumb for this shit * Use kinematic mob controller again It's probably for the best TBH * Stashed shitcode * Remove SlipController * In which movement code is entirely refactored * Singularity fix * Fix ApplyLinearImpulse * MoveRelay fix * Fix door collisions * Disable subfloor collisions Saves on broadphase a fair bit * Re-implement ClimbController * Zumzum's pressure * Laggy item throwing * Minor atmos change * Some caching * Optimise controllers * Optimise CollideWith to hell and back * Re-do throwing and tile friction * Landing too * Optimise controllers * Move CCVars and other stuff swept is beautiful * Cleanup a bunch of controllers * Fix shooting and high pressure movement controller * Flashing improvements * Stuff and things * Combat collisions * Combat mode collisions * Pulling distance joint again * Cleanup physics interfaces * More like scuffedularity * Shit's fucked * Haha tests go green * Bigmoneycrab Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.GUI;
|
||||
using Content.Server.GameObjects.Components.Items;
|
||||
using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using Content.Server.GameObjects.Components.Stack;
|
||||
using Content.Server.GameObjects.EntitySystems.Click;
|
||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||
using Content.Server.Throw;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Interfaces;
|
||||
@@ -144,12 +144,12 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
|
||||
private bool HandleThrowItem(ICommonSession session, EntityCoordinates coords, EntityUid uid)
|
||||
{
|
||||
var plyEnt = ((IPlayerSession)session).AttachedEntity;
|
||||
var playerEnt = ((IPlayerSession)session).AttachedEntity;
|
||||
|
||||
if (plyEnt == null || !plyEnt.IsValid())
|
||||
if (playerEnt == null || !playerEnt.IsValid())
|
||||
return false;
|
||||
|
||||
if (!plyEnt.TryGetComponent(out HandsComponent handsComp))
|
||||
if (!playerEnt.TryGetComponent(out HandsComponent handsComp))
|
||||
return false;
|
||||
|
||||
if (!handsComp.CanDrop(handsComp.ActiveHand))
|
||||
@@ -168,14 +168,19 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
else
|
||||
{
|
||||
stackComp.Use(1);
|
||||
throwEnt = throwEnt.EntityManager.SpawnEntity(throwEnt.Prototype.ID, plyEnt.Transform.Coordinates);
|
||||
throwEnt = throwEnt.EntityManager.SpawnEntity(throwEnt.Prototype.ID, playerEnt.Transform.Coordinates);
|
||||
|
||||
// can only throw one item at a time, regardless of what the prototype stack size is.
|
||||
if (throwEnt.TryGetComponent<StackComponent>(out var newStackComp))
|
||||
newStackComp.Count = 1;
|
||||
}
|
||||
|
||||
throwEnt.ThrowTo(ThrowForce, coords, plyEnt.Transform.Coordinates, false, plyEnt);
|
||||
var direction = coords.ToMapPos(EntityManager) - playerEnt.Transform.WorldPosition;
|
||||
if (direction == Vector2.Zero) return true;
|
||||
|
||||
direction = direction.Normalized * MathF.Min(direction.Length, 8.0f);
|
||||
|
||||
throwEnt.TryThrow(direction * ThrowForce * 15);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user