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 // build the ray
var dir = entity.GetComponent<ITransformComponent>().WorldPosition - myTransform.WorldPosition; 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 // cast the ray
var result = _physMan.IntersectRay(ray, maxRayLen); 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 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 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); var rayResult = _physMan.IntersectRay(ray, MaxWalkDistance, SelfEntity);
if (rayResult.DidHitObject && rayResult.Distance > 1) // hit an impassable object 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. // 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) 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; body.IsScrapingFloor = true;
// KYS, your job is finished. Trigger ILand as well. // 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 userPosition = user.Transform.WorldPosition; //Remember world positions are ephemeral and can only be used instantaneously
var angle = new Angle(clickLocation.Position - userPosition); 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, var rayCastResults = IoCManager.Resolve<IPhysicsManager>().IntersectRay(ray, MaxLength,
Owner.Transform.GetMapTransform().Owner); Owner.Transform.GetMapTransform().Owner);

View File

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

View File

@@ -10,14 +10,15 @@ namespace Content.Shared.Physics
public enum CollisionGroup public enum CollisionGroup
{ {
None = 0, None = 0,
Grid = 1 << 0, // Walls Opaque = 1 << 0, // 1 Blocks light, for lasers
Mob = 1 << 1, // Mobs, like the player or NPCs Impassable = 1 << 1, // 2 Walls, objects impassable by any means
Fixture = 1 << 2, // wall fixtures, like APC or posters MobImpassable = 1 << 2, // 4 Mobs, players, crabs, etc
Items = 1 << 3, // Items on the ground VaultImpassable = 1 << 3, // 8 Things that cannot be jumped over, not half walls or tables
Furniture = 1 << 4, // Tables, machines 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 // 32 possible groups
MobMask = Grid | Mob | Furniture, MobMask = Impassable | MobImpassable | VaultImpassable | SmallImpassable,
AllMask = -1, AllMask = -1,
} }
} }

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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