Northstar Gloves (#16021)
* Added Gloves of North Star, no sprite or talking yet...
* Added sprites for the gloves of the north star...
* Replaced more placeholder sprites for northstar gloves...
* Added gloves of the north star to uplink...
* Added speech on hit, not yet configureable
* Not functional yet, but a step in the right direction I hope...
* IT WORKS!!
* Licensing and cleanup
* Reduced attack speed, changed from chat to popup, added some admin logging. It was causing too much adminlog spam otherwise
* Reorganized some files, final build??
* Changed the adminlog type from Verb to new type ItemConfigure
* More cleanup, fix sprite reference maybe
* Keronshb's suggestions, fixed some stuff, made hit sound use the meaty punch sfx
* Adds support for hiding speak/whisper/emote from adminlogs, makes northstar speak again!
* Some file shuffling, some of Keronshb's requests. Might appear a bit funky in github because vscode kept duplicating files for some reason and I had to delete them
* Made it work with the latest changes on Master
* Final? cleanup, upped dmg to 8, made ui not activate on activateinhand, instead you need to right click
* Set value to 0 credits, that's all
* Well that was much easier than I made it out to be. Now you can only activate the gloves with right click, no more mispredicts.
* Update MeleeWeaponSystem.cs
Iunno why this got changed in the first place, but I'm changin it back
* emptycommit
* emptycommit
* The tiny fixening
2023-05-23 11:12:30 -07:00
using Content.Server.Chat.Systems ;
2022-10-17 15:54:31 +11:00
using Content.Server.Movement.Systems ;
2023-08-07 12:09:35 +03:00
using Content.Shared.Damage.Events ;
2023-09-28 16:20:29 -07:00
using Content.Shared.Damage.Systems ;
using Content.Shared.Effects ;
Northstar Gloves (#16021)
* Added Gloves of North Star, no sprite or talking yet...
* Added sprites for the gloves of the north star...
* Replaced more placeholder sprites for northstar gloves...
* Added gloves of the north star to uplink...
* Added speech on hit, not yet configureable
* Not functional yet, but a step in the right direction I hope...
* IT WORKS!!
* Licensing and cleanup
* Reduced attack speed, changed from chat to popup, added some admin logging. It was causing too much adminlog spam otherwise
* Reorganized some files, final build??
* Changed the adminlog type from Verb to new type ItemConfigure
* More cleanup, fix sprite reference maybe
* Keronshb's suggestions, fixed some stuff, made hit sound use the meaty punch sfx
* Adds support for hiding speak/whisper/emote from adminlogs, makes northstar speak again!
* Some file shuffling, some of Keronshb's requests. Might appear a bit funky in github because vscode kept duplicating files for some reason and I had to delete them
* Made it work with the latest changes on Master
* Final? cleanup, upped dmg to 8, made ui not activate on activateinhand, instead you need to right click
* Set value to 0 credits, that's all
* Well that was much easier than I made it out to be. Now you can only activate the gloves with right click, no more mispredicts.
* Update MeleeWeaponSystem.cs
Iunno why this got changed in the first place, but I'm changin it back
* emptycommit
* emptycommit
* The tiny fixening
2023-05-23 11:12:30 -07:00
using Content.Shared.Speech.Components ;
2022-09-29 15:51:59 +10:00
using Content.Shared.Weapons.Melee ;
using Content.Shared.Weapons.Melee.Events ;
using Robust.Shared.Map ;
using Robust.Shared.Player ;
2023-12-29 04:47:43 -08:00
using System.Linq ;
using System.Numerics ;
2022-09-29 15:51:59 +10:00
namespace Content.Server.Weapons.Melee ;
public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
{
2024-03-31 23:39:34 -04:00
[Dependency] private readonly ChatSystem _chat = default ! ;
[Dependency] private readonly DamageExamineSystem _damageExamine = default ! ;
[Dependency] private readonly LagCompensationSystem _lag = default ! ;
[Dependency] private readonly SharedColorFlashEffectSystem _color = default ! ;
2022-09-29 15:51:59 +10:00
public override void Initialize ( )
{
base . Initialize ( ) ;
Northstar Gloves (#16021)
* Added Gloves of North Star, no sprite or talking yet...
* Added sprites for the gloves of the north star...
* Replaced more placeholder sprites for northstar gloves...
* Added gloves of the north star to uplink...
* Added speech on hit, not yet configureable
* Not functional yet, but a step in the right direction I hope...
* IT WORKS!!
* Licensing and cleanup
* Reduced attack speed, changed from chat to popup, added some admin logging. It was causing too much adminlog spam otherwise
* Reorganized some files, final build??
* Changed the adminlog type from Verb to new type ItemConfigure
* More cleanup, fix sprite reference maybe
* Keronshb's suggestions, fixed some stuff, made hit sound use the meaty punch sfx
* Adds support for hiding speak/whisper/emote from adminlogs, makes northstar speak again!
* Some file shuffling, some of Keronshb's requests. Might appear a bit funky in github because vscode kept duplicating files for some reason and I had to delete them
* Made it work with the latest changes on Master
* Final? cleanup, upped dmg to 8, made ui not activate on activateinhand, instead you need to right click
* Set value to 0 credits, that's all
* Well that was much easier than I made it out to be. Now you can only activate the gloves with right click, no more mispredicts.
* Update MeleeWeaponSystem.cs
Iunno why this got changed in the first place, but I'm changin it back
* emptycommit
* emptycommit
* The tiny fixening
2023-05-23 11:12:30 -07:00
SubscribeLocalEvent < MeleeSpeechComponent , MeleeHitEvent > ( OnSpeechHit ) ;
2023-08-07 12:09:35 +03:00
SubscribeLocalEvent < MeleeWeaponComponent , DamageExamineEvent > ( OnMeleeExamineDamage ) ;
2022-09-29 15:51:59 +10:00
}
2023-08-07 12:09:35 +03:00
private void OnMeleeExamineDamage ( EntityUid uid , MeleeWeaponComponent component , ref DamageExamineEvent args )
2022-09-29 15:51:59 +10:00
{
2023-09-28 16:20:29 -07:00
if ( component . Hidden )
2022-09-29 15:51:59 +10:00
return ;
2023-06-07 16:26:45 -04:00
var damageSpec = GetDamage ( uid , args . User , component ) ;
2022-09-29 15:51:59 +10:00
2023-10-09 03:27:41 +11:00
if ( damageSpec . Empty )
2022-09-29 15:51:59 +10:00
return ;
2025-02-18 08:28:42 +01:00
_damageExamine . AddDamageExamine ( args . Message , Damageable . ApplyUniversalAllModifiers ( damageSpec ) , Loc . GetString ( "damage-melee" ) ) ;
2022-09-29 15:51:59 +10:00
}
2024-10-14 00:40:59 -05:00
protected override bool ArcRaySuccessful ( EntityUid targetUid ,
Vector2 position ,
Angle angle ,
Angle arcWidth ,
float range ,
MapId mapId ,
EntityUid ignore ,
ICommonSession ? session )
2023-05-02 05:07:17 +10:00
{
// Originally the client didn't predict damage effects so you'd intuit some level of how far
// in the future you'd need to predict, but then there was a lot of complaining like "why would you add artifical delay" as if ping is a choice.
// Now damage effects are predicted but for wide attacks it differs significantly from client and server so your game could be lying to you on hits.
// This isn't fair in the slightest because it makes ping a huge advantage and this would be a hidden system.
// Now the client tells us what they hit and we validate if it's plausible.
// Even if the client is sending entities they shouldn't be able to hit:
// A) Wide-damage is split anyway
// B) We run the same validation we do for click attacks.
// Could also check the arc though future effort + if they're aimbotting it's not really going to make a difference.
// (This runs lagcomp internally and is what clickattacks use)
2025-02-02 23:03:31 +01:00
if ( ! Interaction . InRangeUnobstructed ( ignore , targetUid , range + 0.1f , overlapCheck : false ) )
2023-05-02 05:07:17 +10:00
return false ;
// TODO: Check arc though due to the aforementioned aimbot + damage split comments it's less important.
return true ;
}
2022-11-14 08:33:54 +11:00
protected override bool InRange ( EntityUid user , EntityUid target , float range , ICommonSession ? session )
2022-10-17 15:54:31 +11:00
{
EntityCoordinates targetCoordinates ;
Angle targetLocalAngle ;
2023-10-28 09:59:53 +11:00
if ( session is { } pSession )
2022-10-17 15:54:31 +11:00
{
( targetCoordinates , targetLocalAngle ) = _lag . GetCoordinatesAngle ( target , pSession ) ;
2025-02-02 23:03:31 +01:00
return Interaction . InRangeUnobstructed ( user , target , targetCoordinates , targetLocalAngle , range , overlapCheck : false ) ;
2022-10-17 15:54:31 +11:00
}
2024-05-24 17:03:03 +12:00
return Interaction . InRangeUnobstructed ( user , target , range ) ;
2022-11-14 08:33:54 +11:00
}
protected override void DoDamageEffect ( List < EntityUid > targets , EntityUid ? user , TransformComponent targetXform )
{
var filter = Filter . Pvs ( targetXform . Coordinates , entityMan : EntityManager ) . RemoveWhereAttachedEntity ( o = > o = = user ) ;
2023-08-11 03:44:52 +10:00
_color . RaiseEffect ( Color . Red , targets , filter ) ;
2022-09-29 15:51:59 +10:00
}
2023-10-17 20:12:00 -05:00
public override void DoLunge ( EntityUid user , EntityUid weapon , Angle angle , Vector2 localPos , string? animation , bool predicted = true )
2022-09-29 15:51:59 +10:00
{
2023-04-10 15:37:03 +10:00
Filter filter ;
if ( predicted )
{
filter = Filter . PvsExcept ( user , entityManager : EntityManager ) ;
}
else
{
filter = Filter . Pvs ( user , entityManager : EntityManager ) ;
}
2023-10-17 20:12:00 -05:00
RaiseNetworkEvent ( new MeleeLungeEvent ( GetNetEntity ( user ) , GetNetEntity ( weapon ) , angle , localPos , animation ) , filter ) ;
2022-09-29 15:51:59 +10:00
}
Northstar Gloves (#16021)
* Added Gloves of North Star, no sprite or talking yet...
* Added sprites for the gloves of the north star...
* Replaced more placeholder sprites for northstar gloves...
* Added gloves of the north star to uplink...
* Added speech on hit, not yet configureable
* Not functional yet, but a step in the right direction I hope...
* IT WORKS!!
* Licensing and cleanup
* Reduced attack speed, changed from chat to popup, added some admin logging. It was causing too much adminlog spam otherwise
* Reorganized some files, final build??
* Changed the adminlog type from Verb to new type ItemConfigure
* More cleanup, fix sprite reference maybe
* Keronshb's suggestions, fixed some stuff, made hit sound use the meaty punch sfx
* Adds support for hiding speak/whisper/emote from adminlogs, makes northstar speak again!
* Some file shuffling, some of Keronshb's requests. Might appear a bit funky in github because vscode kept duplicating files for some reason and I had to delete them
* Made it work with the latest changes on Master
* Final? cleanup, upped dmg to 8, made ui not activate on activateinhand, instead you need to right click
* Set value to 0 credits, that's all
* Well that was much easier than I made it out to be. Now you can only activate the gloves with right click, no more mispredicts.
* Update MeleeWeaponSystem.cs
Iunno why this got changed in the first place, but I'm changin it back
* emptycommit
* emptycommit
* The tiny fixening
2023-05-23 11:12:30 -07:00
private void OnSpeechHit ( EntityUid owner , MeleeSpeechComponent comp , MeleeHitEvent args )
{
if ( ! args . IsHit | |
! args . HitEntities . Any ( ) )
{
return ;
}
if ( comp . Battlecry ! = null ) //If the battlecry is set to empty, doesn't speak
{
2023-05-30 18:11:35 -07:00
_chat . TrySendInGameICMessage ( args . User , comp . Battlecry , InGameICChatType . Speak , true , true , checkRadioPrefix : false ) ; //Speech that isn't sent to chat or adminlogs
Northstar Gloves (#16021)
* Added Gloves of North Star, no sprite or talking yet...
* Added sprites for the gloves of the north star...
* Replaced more placeholder sprites for northstar gloves...
* Added gloves of the north star to uplink...
* Added speech on hit, not yet configureable
* Not functional yet, but a step in the right direction I hope...
* IT WORKS!!
* Licensing and cleanup
* Reduced attack speed, changed from chat to popup, added some admin logging. It was causing too much adminlog spam otherwise
* Reorganized some files, final build??
* Changed the adminlog type from Verb to new type ItemConfigure
* More cleanup, fix sprite reference maybe
* Keronshb's suggestions, fixed some stuff, made hit sound use the meaty punch sfx
* Adds support for hiding speak/whisper/emote from adminlogs, makes northstar speak again!
* Some file shuffling, some of Keronshb's requests. Might appear a bit funky in github because vscode kept duplicating files for some reason and I had to delete them
* Made it work with the latest changes on Master
* Final? cleanup, upped dmg to 8, made ui not activate on activateinhand, instead you need to right click
* Set value to 0 credits, that's all
* Well that was much easier than I made it out to be. Now you can only activate the gloves with right click, no more mispredicts.
* Update MeleeWeaponSystem.cs
Iunno why this got changed in the first place, but I'm changin it back
* emptycommit
* emptycommit
* The tiny fixening
2023-05-23 11:12:30 -07:00
}
}
2022-09-29 15:51:59 +10:00
}