new layers (#483)

This commit is contained in:
L.E.D
2019-12-01 09:20:50 -05:00
committed by Pieter-Jan Briers
parent 7c54a3c923
commit fac91af34d
31 changed files with 56 additions and 3915 deletions

View File

@@ -111,7 +111,7 @@ namespace Content.Server.AI
// build the ray
var dir = entity.GetComponent<ITransformComponent>().WorldPosition - myTransform.WorldPosition;
var ray = new Ray(myTransform.WorldPosition, dir.Normalized, (int)(CollisionGroup.Mob | CollisionGroup.Grid));
var ray = new Ray(myTransform.WorldPosition, dir.Normalized, (int)(CollisionGroup.MobImpassable | CollisionGroup.Impassable));
// cast the ray
var result = _physMan.IntersectRay(ray, maxRayLen);

View File

@@ -126,7 +126,7 @@ namespace Content.Server.AI
for (var i = 0; i < 3; i++) // you get 3 chances to find a place to walk
{
var dir = new Vector2(Random01(ref rngState) * 2 - 1, Random01(ref rngState) *2 -1);
var ray = new Ray(entWorldPos, dir, (int) CollisionGroup.Grid);
var ray = new Ray(entWorldPos, dir, (int) CollisionGroup.Impassable);
var rayResult = _physMan.IntersectRay(ray, MaxWalkDistance, SelfEntity);
if (rayResult.DidHitObject && rayResult.Distance > 1) // hit an impassable object

View File

@@ -41,7 +41,7 @@ namespace Content.Server.GameObjects.Components
// This would allow ricochets off walls, and weird gravity effects from slowing the object.
if (collidedwith.Count > 0 && Owner.TryGetComponent(out CollidableComponent body) && body.PhysicsShapes.Count >= 1)
{
body.PhysicsShapes[0].CollisionMask &= (int)~CollisionGroup.Mob;
body.PhysicsShapes[0].CollisionMask &= (int)~CollisionGroup.MobImpassable;
body.IsScrapingFloor = true;
// KYS, your job is finished. Trigger ILand as well.

View File

@@ -89,7 +89,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
var userPosition = user.Transform.WorldPosition; //Remember world positions are ephemeral and can only be used instantaneously
var angle = new Angle(clickLocation.Position - userPosition);
var ray = new Ray(userPosition, angle.ToVec(), (int)(CollisionGroup.Grid | CollisionGroup.Mob));
var ray = new Ray(userPosition, angle.ToVec(), (int)(CollisionGroup.Impassable | CollisionGroup.MobImpassable));
var rayCastResults = IoCManager.Resolve<IPhysicsManager>().IntersectRay(ray, MaxLength,
Owner.Transform.GetMapTransform().Owner);

View File

@@ -196,7 +196,7 @@ namespace Content.Server.GameObjects.EntitySystems
if(colComp.PhysicsShapes.Count == 0)
colComp.PhysicsShapes.Add(new PhysShapeAabb());
colComp.PhysicsShapes[0].CollisionMask |= (int)CollisionGroup.Mob;
colComp.PhysicsShapes[0].CollisionMask |= (int)CollisionGroup.MobImpassable;
colComp.IsScrapingFloor = false;
}

View File

@@ -9,15 +9,16 @@ namespace Content.Shared.Physics
[Flags, PublicAPI]
public enum CollisionGroup
{
None = 0,
Grid = 1 << 0, // Walls
Mob = 1 << 1, // Mobs, like the player or NPCs
Fixture = 1 << 2, // wall fixtures, like APC or posters
Items = 1 << 3, // Items on the ground
Furniture = 1 << 4, // Tables, machines
None = 0,
Opaque = 1 << 0, // 1 Blocks light, for lasers
Impassable = 1 << 1, // 2 Walls, objects impassable by any means
MobImpassable = 1 << 2, // 4 Mobs, players, crabs, etc
VaultImpassable = 1 << 3, // 8 Things that cannot be jumped over, not half walls or tables
SmallImpassable = 1 << 4, // 16 Things a smaller object - a cat, a crab - can't go through - a wall, but not a computer terminal or a table
Clickable = 1 << 5, // 32 Temporary "dummy" layer to ensure that objects can still be clicked even if they don't collide with anything (you can't interact with objects that have no layer, including items)
// 32 possible groups
MobMask = Grid | Mob | Furniture,
MobMask = Impassable | MobImpassable | VaultImpassable | SmallImpassable,
AllMask = -1,
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -35,6 +35,9 @@
state: tdoppler
- type: Clickable
- type: Collidable
shapes:
- !type:PhysShapeAabb
layer: 15
- type: SnapGrid
offset: Center
- type: ResearchPointSource

View File

@@ -15,8 +15,8 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.2,-0.2,0.2,0.2"
layer: 1
mask: 3
layer: 32
mask: 30
- type: Physics
edgeslide: false
- type: Projectile

View File

@@ -25,8 +25,9 @@
- type: Collidable
shapes:
- !type:PhysShapeAabb
mask: 2
layer: 16
bounds: "-0.49,-0.49,0.49,0.49" # don't want this colliding with walls or they won't close
mask: 4
layer: 31
- type: Airlock
- type: Appearance
visuals:

View File

@@ -13,7 +13,7 @@
- type: Collidable
shapes:
- !type:PhysShapeAabb
layer: 1
layer: 31
- type: Damageable
- type: Destructible
thresholdvalue: 100

View File

@@ -11,8 +11,7 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.5,-0.25,0.5,0.25"
mask: 19
layer: 16
layer: 15
- type: Icon
sprite: Buildings/computer.rsi
state: computer

View File

@@ -14,8 +14,7 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.5,-0.25,0.5,0.25"
mask: 19
layer: 16
layer: 15
IsScrapingFloor: true
- type: Physics
mass: 15

View File

@@ -11,8 +11,7 @@
- type: Collidable
shapes:
- !type:PhysShapeAabb
mask: 19
layer: 1
layer: 31
- type: Damageable
- type: Destructible
thresholdvalue: 50

View File

@@ -10,8 +10,7 @@
- type: Collidable
shapes:
- !type:PhysShapeAabb
mask: 19
layer: 16
layer: 31
- type: SnapGrid
offset: Center

View File

@@ -32,8 +32,7 @@
- type: Collidable
shapes:
- !type:PhysShapeAabb
mask: 19
layer: 16
layer: 15
- type: SnapGrid
offset: Center
- type: Lathe
@@ -75,8 +74,7 @@
- type: Collidable
shapes:
- !type:PhysShapeAabb
mask: 19
layer: 16
layer: 15
- type: SnapGrid
offset: Center
- type: ResearchClient

View File

@@ -17,7 +17,7 @@
- type: Collidable
shapes:
- !type:PhysShapeAabb
layer: 1
layer: 20
- type: Damageable
- type: Destructible
thresholdvalue: 100

View File

@@ -21,8 +21,7 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.5,-0.25,0.5,0.25"
mask: 19
layer: 16
layer: 15
IsScrapingFloor: true
- type: Physics
mass: 25

View File

@@ -11,8 +11,7 @@
- type: Collidable
shapes:
- !type:PhysShapeAabb
mask: 19
layer: 16
layer: 32
- type: Clickable
- type: Physics
mass: 25

View File

@@ -44,8 +44,7 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.5, -0.5, 0.3, 0.5"
mask: 19
layer: 16
layer: 31
- type: Sprite
texture: Objects/Power/generator.png
- type: Icon
@@ -61,8 +60,7 @@
- type: Collidable
shapes:
- !type:PhysShapeAabb
mask: 19
layer: 4
layer: 32
- type: Sprite
drawdepth: WallMountedItems
texture: Objects/Power/provider.png
@@ -119,8 +117,7 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.5, -0.5, 0.5, 0.5"
mask: 19
layer: 16
layer: 31
- type: Sprite
netsync: false
sprite: Buildings/smes.rsi
@@ -159,8 +156,7 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.5, -0.25, 0.5, 0.25"
mask: 19
layer: 16
layer: 31
- type: Sprite
texture: Objects/Power/wiredmachine.png
- type: Icon
@@ -180,8 +176,7 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.5, -0.25, 0.5, 0.25"
mask: 19
layer: 16
layer: 31
- type: Sprite
texture: Objects/Furniture/wirelessmachine.png
- type: Icon

View File

@@ -7,8 +7,7 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.4,-0.25,0.4,0.25"
mask: 19
layer: 16
layer: 15
IsScrapingFloor: true
- type: Physics
mass: 25

View File

@@ -20,8 +20,8 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.5,-0.25,0.5,0.25"
mask: 19
layer: 16
mask: 30
layer: 31
IsScrapingFloor: true
- type: Physics
mass: 25

View File

@@ -20,8 +20,8 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.4, -0.4, 0.4, 0.4"
layer: 16
mask: 19
layer: 31
mask: 30
IsScrapingFloor: true
- type: Physics
mass: 25

View File

@@ -15,8 +15,7 @@
- type: Collidable
shapes:
- !type:PhysShapeAabb
mask: 19
layer: 16
layer: 20
- type: SnapGrid
offset: Center

View File

@@ -20,8 +20,7 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.5,-0.25,0.5,0.25"
mask: 19
layer: 16
layer: 15
- type: SnapGrid
offset: Center
- type: Damageable

View File

@@ -12,7 +12,7 @@
- type: Collidable
shapes:
- !type:PhysShapeAabb
layer: 1
layer: 31
- type: Damageable
- type: Destructible
thresholdvalue: 100

View File

@@ -17,7 +17,7 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.5, -0.5, 0.3, 0.5"
layer: 1
layer: 30
- type: Damageable
- type: Destructible
thresholdvalue: 100

View File

@@ -9,8 +9,8 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.25,-0.25,0.25,0.25"
mask: 5
layer: 8
mask: 26
layer: 32
IsScrapingFloor: true
- type: Physics
mass: 5

View File

@@ -122,8 +122,8 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.25,-0.25,0.25,0.25"
mask: 19
layer: 16
mask: 2
layer: 32
IsScrapingFloor: true
- type: entity
@@ -153,8 +153,8 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.25,-0.25,0.25,0.25"
mask: 19
layer: 16
mask: 2
layer: 32
IsScrapingFloor: true
- type: entity
@@ -183,6 +183,6 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.25,-0.25,0.25,0.25"
mask: 19
layer: 16
mask: 2
layer: 32
IsScrapingFloor: true

View File

@@ -54,8 +54,8 @@
shapes:
- !type:PhysShapeAabb
bounds: "-0.5,-0.25,-0.05,0.25"
mask: 19
layer: 2
mask: 30
layer: 4
- type: Input
context: "human"

View File

@@ -12,8 +12,7 @@
- type: Clickable
- type: Collidable
mask: 3
layer: 1
layer: 31
shape:
bounds: "-0.5,-0.25,0.5,0.25"
IsScrapingFloor: true