Update submodule.

Guns work again.
This commit is contained in:
Pieter-Jan Briers
2018-09-17 12:36:09 +02:00
parent 2dd3f24fb2
commit 73712b4e39
6 changed files with 201 additions and 198 deletions

View File

@@ -1,7 +1,5 @@
using SS14.Server.GameObjects; using SS14.Server.GameObjects.EntitySystems;
using SS14.Server.GameObjects.EntitySystems;
using SS14.Shared.Audio; using SS14.Shared.Audio;
using SS14.Shared.GameObjects;
using SS14.Shared.GameObjects.EntitySystemMessages; using SS14.Shared.GameObjects.EntitySystemMessages;
using SS14.Shared.Interfaces.GameObjects; using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components; using SS14.Shared.Interfaces.GameObjects.Components;
@@ -17,20 +15,22 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
{ {
public class HitscanWeaponComponent : RangedWeaponComponent public class HitscanWeaponComponent : RangedWeaponComponent
{ {
private const float MaxLength = 20;
public override string Name => "HitscanWeapon"; public override string Name => "HitscanWeapon";
string spritename = "Objects/laser.png"; private const string SpriteName = "Objects/laser.png";
protected override void Fire(IEntity user, GridLocalCoordinates clicklocation) protected override void Fire(IEntity user, GridLocalCoordinates clicklocation)
{ {
var userposition = user.GetComponent<ITransformComponent>().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()); var ray = new Ray(userPosition, angle.ToVec());
var raycastresults = IoCManager.Resolve<ICollisionManager>().IntersectRay(ray, 20, Owner.GetComponent<ITransformComponent>().GetMapTransform().Owner); var rayCastResults = IoCManager.Resolve<ICollisionManager>().IntersectRay(ray, MaxLength,
Owner.Transform.GetMapTransform().Owner);
Hit(raycastresults); Hit(rayCastResults);
AfterEffects(user, raycastresults, angle); AfterEffects(user, rayCastResults, angle);
} }
protected virtual void Hit(RayCastResults ray) protected virtual void Hit(RayCastResults ray)
@@ -44,15 +44,15 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
protected virtual void AfterEffects(IEntity user, RayCastResults ray, Angle angle) protected virtual void AfterEffects(IEntity user, RayCastResults ray, Angle angle)
{ {
var time = IoCManager.Resolve<IGameTiming>().CurTime; var time = IoCManager.Resolve<IGameTiming>().CurTime;
var offset = angle.ToVec() * ray.Distance / 2; var dist = ray.DidHitObject ? ray.Distance : MaxLength;
var offset = angle.ToVec() * dist / 2;
EffectSystemMessage message = new EffectSystemMessage var message = new EffectSystemMessage
{ {
EffectSprite = spritename, EffectSprite = SpriteName,
Born = time, Born = time,
DeathTime = time + TimeSpan.FromSeconds(1), DeathTime = time + TimeSpan.FromSeconds(1),
Size = new Vector2(ray.Distance, 1f), Size = new Vector2(dist, 1f),
Coordinates = user.GetComponent<ITransformComponent>().LocalPosition.Translated(offset), Coordinates = user.Transform.LocalPosition.Translated(offset),
//Rotated from east facing //Rotated from east facing
Rotation = (float) angle.Theta, Rotation = (float) angle.Theta,
ColorDelta = new Vector4(0, 0, 0, -1500f), ColorDelta = new Vector4(0, 0, 0, -1500f),

View File

@@ -5,6 +5,7 @@ using SS14.Server.Interfaces.GameObjects;
using SS14.Shared.Interfaces.GameObjects; using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components; using SS14.Shared.Interfaces.GameObjects.Components;
using SS14.Shared.IoC; using SS14.Shared.IoC;
using SS14.Shared.Log;
using SS14.Shared.Map; using SS14.Shared.Map;
using SS14.Shared.Maths; using SS14.Shared.Maths;

View File

@@ -21,6 +21,7 @@
- whisper - whisper
- me - me
- ooc - ooc
- showtime
- Index: 100 - Index: 100
Name: Administrator Name: Administrator
@@ -32,4 +33,5 @@
- whisper - whisper
- me - me
- ooc - ooc
- showtime
CanViewVar: true CanViewVar: true

File diff suppressed because it is too large Load Diff

View File

@@ -6,7 +6,7 @@
- type: Sprite - type: Sprite
directional: false directional: false
texture: Objects/projectilebullet.png texture: Objects/projectilebullet.png
rotation: 180 #rotation: -180
- type: Icon - type: Icon
texture: Objects/projectilebullet.png texture: Objects/projectilebullet.png

2
engine

Submodule engine updated: 796626b7d8...e1d1a8ea9d