Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Enemy Control #352

Merged
merged 53 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
c0e8286
Add Enemy Control
xAstroBoy Feb 2, 2024
b306c02
ops , pepega moment.
xAstroBoy Feb 2, 2024
4fe021c
use RPC switch behaviour
xAstroBoy Feb 2, 2024
39aafd9
Merge pull request #2 from PROJECT-Ruby-Elk/EnemyControl
xAstroBoy Feb 3, 2024
d932989
style: format scripts
github-actions[bot] Feb 3, 2024
eead016
fix: SFX will not be played due to incorrect early returns
winstxnhdw Feb 3, 2024
53b6d58
style: do not explicitly use `private`
winstxnhdw Feb 3, 2024
132b3cf
refactor: remove unnecessary null checks and clean up style
winstxnhdw Feb 3, 2024
3312595
push enemy to open doors
xAstroBoy Feb 3, 2024
03c0879
Merge branch 'enemy-control' of https://github.com/xAstroBoy/lc-hax i…
xAstroBoy Feb 3, 2024
6a3240e
style: format scripts
github-actions[bot] Feb 3, 2024
97d2569
refactor: more housekeeping
winstxnhdw Feb 3, 2024
a592374
refactor: more housekeeping
winstxnhdw Feb 3, 2024
934a873
refactor: clean up new trigger mod
winstxnhdw Feb 3, 2024
0fdc2c5
Block Voting Early both hud and RPC
xAstroBoy Feb 3, 2024
5292235
style: format scripts
github-actions[bot] Feb 3, 2024
e8a27f7
block scan if we are possessing a enemy
xAstroBoy Feb 3, 2024
e1387b9
add Hold listener for secondary attack
xAstroBoy Feb 3, 2024
200d971
Fix
xAstroBoy Feb 3, 2024
ee2806a
style: format scripts
github-actions[bot] Feb 3, 2024
3d77862
im dumb lol, wrong harmony patch
xAstroBoy Feb 3, 2024
e41b1ae
style: format scripts
github-actions[bot] Feb 3, 2024
88dcfc0
Fix Enemies not able to grab items.
xAstroBoy Feb 3, 2024
635c18b
style: format scripts
github-actions[bot] Feb 3, 2024
aadbe01
Move PlaySFX to bottom
xAstroBoy Feb 3, 2024
6063d98
Better grab item approach for hoardingbug
xAstroBoy Feb 3, 2024
965a585
Merge branch 'enemy-control' of https://github.com/xAstroBoy/lc-hax i…
xAstroBoy Feb 3, 2024
83fcdc8
style: format scripts
github-actions[bot] Feb 3, 2024
d203bc8
Finally Hoarding Bug now is able to grab items
xAstroBoy Feb 3, 2024
251298a
Merge branch 'enemy-control' of https://github.com/xAstroBoy/lc-hax i…
xAstroBoy Feb 3, 2024
ee8fd6c
HoardingBug : Move grab ability in primary
xAstroBoy Feb 3, 2024
f16be6c
style: format scripts
github-actions[bot] Feb 3, 2024
a0c5baf
Move grab scrap in primary
xAstroBoy Feb 3, 2024
562d605
Merge branch 'enemy-control' of https://github.com/xAstroBoy/lc-hax i…
xAstroBoy Feb 3, 2024
750f034
style: format scripts
github-actions[bot] Feb 3, 2024
2f4d60e
make baboon able to use items as well
xAstroBoy Feb 3, 2024
4113deb
Baboon now can shoot lol
xAstroBoy Feb 3, 2024
cb65bee
chore: fix static fields formatting
winstxnhdw Feb 5, 2024
131e8b7
style: format scripts
github-actions[bot] Feb 5, 2024
25867e5
style: fix naming violations
winstxnhdw Feb 5, 2024
765930d
style: format scripts
github-actions[bot] Feb 5, 2024
d638d13
Merge branch 'main' into enemy-control
winstxnhdw Feb 5, 2024
cdcaa0d
style: fix naming violations
winstxnhdw Feb 5, 2024
5c37dde
style: wrap lines that are too long
winstxnhdw Feb 5, 2024
889fd57
chore: remove deprecated `max_line_length`
winstxnhdw Feb 5, 2024
0305191
style: use `foreach` instead
winstxnhdw Feb 5, 2024
474cd94
chore: remove unused inputs
winstxnhdw Feb 5, 2024
02d2f48
style: fix naming violations
winstxnhdw Feb 6, 2024
47e8d2d
chore: remove redundant event
winstxnhdw Feb 6, 2024
0e251c5
chore: add enemy behaviour helpers
winstxnhdw Feb 6, 2024
897e352
refactor: add `CharArray` alias
winstxnhdw Feb 6, 2024
3440948
refactor: use interface instead of extension methods
winstxnhdw Feb 6, 2024
bb5911d
refactor: clean up patches
winstxnhdw Feb 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 31 additions & 26 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,58 @@ charset = utf-8

[*.cs]
# Basic text
charset = utf-8
indent_size = 4
insert_final_newline = true
max_line_length = 120
trim_trailing_whitespace = true
charset = utf-8

# Braces
csharp_new_line_before_open_brace = none
csharp_new_line_before_members_in_object_initializers = false
csharp_new_line_before_members_in_anonymous_types = false
csharp_prefer_braces = false:error
csharp_prefer_braces = false:warning

# Always use "this" keyword
dotnet_style_qualification_for_field = true:error
dotnet_style_qualification_for_property = true:error
dotnet_style_qualification_for_method = true:error
dotnet_style_qualification_for_event = true:error
dotnet_style_qualification_for_field = true:warning
dotnet_style_qualification_for_property = true:warning
dotnet_style_qualification_for_method = true:warning
dotnet_style_qualification_for_event = true:warning

# Use language keywords instead of framework type names for type references
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
dotnet_style_predefined_type_for_member_access = true:warning

# Suggest acessibility modifier is redundant
dotnet_style_require_accessibility_modifiers = never:error
dotnet_style_require_accessibility_modifiers = never:warning

# Never use "var"
csharp_style_var_for_built_in_types = false:warning
csharp_style_var_when_type_is_apparent = false:warning
csharp_style_var_elsewhere = false:warning

# Only file-scoped namespaces are allowed
csharp_style_namespace_declarations = file_scoped:warning

# Prefer expression bodies for single line statements
csharp_style_expression_bodied_constructors = when_on_single_line:warning
csharp_style_expression_bodied_methods = when_on_single_line:warning
csharp_style_expression_bodied_operators = when_on_single_line:warning
csharp_style_expression_bodied_properties = when_on_single_line:warning
csharp_style_expression_bodied_indexers = when_on_single_line:warning
csharp_style_expression_bodied_accessors = when_on_single_line:warning

# Symbols
dotnet_naming_symbols.special_fields.applicable_kinds = field
dotnet_naming_symbols.classes.applicable_accessibilities = *
dotnet_naming_symbols.special_fields.required_modifiers = static,readonly,const
dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.applicable_accessibilities = *
dotnet_naming_symbols.static_fields.required_modifiers = static

dotnet_naming_symbols.fields.applicable_kinds = field,parameter,event,delegate
dotnet_naming_symbols.fields.applicable_kinds = field, parameter
dotnet_naming_symbols.fields.applicable_accessibilities = *

dotnet_naming_symbols.methods.applicable_kinds = method,property
dotnet_naming_symbols.methods.applicable_kinds = method, property, event, delegate
dotnet_naming_symbols.methods.applicable_accessibilities = *

dotnet_naming_symbols.classes.applicable_kinds = class,struct,interface,enum
dotnet_naming_symbols.classes.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.classes.applicable_accessibilities = *

# Styles
Expand All @@ -61,9 +71,9 @@ dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.first_word_upper.capitalization = first_word_upper

# Rules
dotnet_naming_rule.special_fields_pascal_case.symbols = special_fields
dotnet_naming_rule.special_fields_pascal_case.severity = error
dotnet_naming_rule.special_fields_pascal_case.style = pascal_case
dotnet_naming_rule.static_fields_pascal_case.symbols = static_fields
dotnet_naming_rule.static_fields_pascal_case.severity = error
dotnet_naming_rule.static_fields_pascal_case.style = pascal_case

dotnet_naming_rule.fields_camel_case.symbols = fields
dotnet_naming_rule.fields_camel_case.severity = error
Expand All @@ -82,13 +92,8 @@ dotnet_analyzer_diagnostic.category-Style.severity = warning
dotnet_analyzer_diagnostic.category-Performance.severity = warning
dotnet_analyzer_diagnostic.category-Design.severity = warning

dotnet_diagnostic.IDE0002.severity = none
dotnet_diagnostic.IDE0044.severity = none
dotnet_diagnostic.IDE0072.severity = none
dotnet_diagnostic.IDE0051.severity = none
dotnet_diagnostic.IDE0021.severity = none
dotnet_diagnostic.IDE0022.severity = none
dotnet_diagnostic.IDE0160.severity = none
dotnet_diagnostic.IDE0130.severity = none
dotnet_diagnostic.IDE0002.severity = none # Simplify member access
dotnet_diagnostic.IDE0051.severity = none # Remove unused private member
dotnet_diagnostic.IDE0072.severity = none # Add missing cases to switch expression
dotnet_diagnostic.IDE0130.severity = none # Namespace does not match folder structure
dotnet_diagnostic.CS8524.severity = none
dotnet_diagnostic.CA1001.severity = error
4 changes: 1 addition & 3 deletions lc-hax/Scripts/Commands/ClearCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@

[Command("/clear")]
public class ClearCommand : ICommand {
public void Execute(StringArray _) {
Chat.Clear();
}
public void Execute(StringArray _) => Chat.Clear();
}
4 changes: 1 addition & 3 deletions lc-hax/Scripts/Commands/Door/LockCommand.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
[Command("/lock")]
public class LockCommand : ICommand, ISecureGate {
public void Execute(StringArray _) {
this.SetSecureDoorState(false);
}
public void Execute(StringArray _) => this.SetSecureDoorState(false);
}
4 changes: 1 addition & 3 deletions lc-hax/Scripts/Commands/Entrance/EnterCommand.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
[Command("/enter")]
public class EnterCommand : IEntrance, ICommand {
public void Execute(StringArray _) {
this.EntranceTeleport(false);
}
public void Execute(StringArray _) => this.EntranceTeleport(false);
}
4 changes: 1 addition & 3 deletions lc-hax/Scripts/Commands/Entrance/ExitCommand.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
[Command("/exit")]
public class ExitCommand : IEntrance, ICommand {
public void Execute(StringArray _) {
this.EntranceTeleport(true);
}
public void Execute(StringArray _) => this.EntranceTeleport(true);
}
4 changes: 1 addition & 3 deletions lc-hax/Scripts/Commands/Ship/CloseCommand.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
[Command("/close")]
public class CloseCommand : ICommand, IShipDoor {
public void Execute(StringArray _) {
this.SetShipDoorState(true);
}
public void Execute(StringArray _) => this.SetShipDoorState(true);
}
4 changes: 1 addition & 3 deletions lc-hax/Scripts/Commands/Ship/OpenCommand.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
[Command("/open")]
public class OpenCommand : ICommand, IShipDoor {
public void Execute(StringArray _) {
this.SetShipDoorState(false);
}
public void Execute(StringArray _) => this.SetShipDoorState(false);
}
4 changes: 1 addition & 3 deletions lc-hax/Scripts/Commands/StartCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@

[Command("/start")]
public class StartGameCommand : ICommand {
public void Execute(StringArray _) {
Helper.StartOfRound?.StartGameServerRpc();
}
public void Execute(StringArray _) => Helper.StartOfRound?.StartGameServerRpc();
}
7 changes: 3 additions & 4 deletions lc-hax/Scripts/Components/KeyboardMovement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Hax;

public class KeyboardMovement : MonoBehaviour {
const float baseSpeed = 20;
const float BaseSpeed = 20;
float SprintMultiplier { get; set; } = 1;

void Update() {
Expand All @@ -20,16 +20,15 @@ void Update() {
this.Move(direction);
}

void UpdateSprintMultiplier(Keyboard keyboard) {
void UpdateSprintMultiplier(Keyboard keyboard) =>
this.SprintMultiplier = keyboard.shiftKey.IsPressed() ? Mathf.Min(this.SprintMultiplier + (5 * Time.deltaTime), 5) : 1;
}

void Move(Vector3 direction) {
Vector3 translatedDirection =
(this.transform.right * direction.x) +
(this.transform.up * direction.y) +
(this.transform.forward * direction.z);

this.transform.position += translatedDirection * Time.deltaTime * baseSpeed * this.SprintMultiplier;
this.transform.position += translatedDirection * Time.deltaTime * KeyboardMovement.BaseSpeed * this.SprintMultiplier;
}
}
16 changes: 6 additions & 10 deletions lc-hax/Scripts/Components/MousePan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,18 @@ public class MousePan : MonoBehaviour {
float Pitch { get; set; } = 0.0f;

void OnEnable() {
InputListener.onLeftBracketPress += this.DecreaseMouseSensitivity;
InputListener.onRightBracketPress += this.IncreaseMouseSensitivity;
InputListener.OnLeftBracketPress += this.DecreaseMouseSensitivity;
InputListener.OnRightBracketPress += this.IncreaseMouseSensitivity;
}

void OnDisable() {
InputListener.onLeftBracketPress -= this.DecreaseMouseSensitivity;
InputListener.onRightBracketPress -= this.IncreaseMouseSensitivity;
InputListener.OnLeftBracketPress -= this.DecreaseMouseSensitivity;
InputListener.OnRightBracketPress -= this.IncreaseMouseSensitivity;
}

void IncreaseMouseSensitivity() {
this.Sensitivity += 0.1f;
}
void IncreaseMouseSensitivity() => this.Sensitivity += 0.1f;

void DecreaseMouseSensitivity() {
this.Sensitivity = Mathf.Max(this.Sensitivity - 0.1f, 0.1f);
}
void DecreaseMouseSensitivity() => this.Sensitivity = Mathf.Max(this.Sensitivity - 0.1f, 0.1f);

void Update() {
this.Yaw += Mouse.current.delta.x.ReadValue() * this.Sensitivity;
Expand Down
Loading
Loading