Conversation
# Conflicts: # S1API/Products/ProductInstance.cs
prefix s1 namespaces with S1
Questpatches
MaxtorCoder
requested changes
May 20, 2025
Collaborator
MaxtorCoder
left a comment
There was a problem hiding this comment.
Re-order the access modifiers as well to how it looks like in the NPC class for example.
S1API/Vehicles/LandVehicle.cs
Outdated
Comment on lines
80
to
95
| private void _setConnection() | ||
| { | ||
| var nm = InstanceFinder.NetworkManager; | ||
| if (nm.IsClientOnly) | ||
| { | ||
| var tempConn = InstanceFinder.ClientManager.Connection; | ||
| if (tempConn != null && tempConn.IsValid) | ||
| _conn = tempConn; | ||
| } | ||
| else if (nm.IsServerOnly || (nm.IsServer && !nm.IsClient)) | ||
| { | ||
| var owner = S1LandVehicle.Owner; | ||
| if (owner != null && owner.IsValid) | ||
| _conn = owner; | ||
| } | ||
| } |
Collaborator
There was a problem hiding this comment.
Suggested change
| private void _setConnection() | |
| { | |
| var nm = InstanceFinder.NetworkManager; | |
| if (nm.IsClientOnly) | |
| { | |
| var tempConn = InstanceFinder.ClientManager.Connection; | |
| if (tempConn != null && tempConn.IsValid) | |
| _conn = tempConn; | |
| } | |
| else if (nm.IsServerOnly || (nm.IsServer && !nm.IsClient)) | |
| { | |
| var owner = S1LandVehicle.Owner; | |
| if (owner != null && owner.IsValid) | |
| _conn = owner; | |
| } | |
| } | |
| private void SetConnection() | |
| { | |
| var nm = InstanceFinder.NetworkManager; | |
| if (nm.IsClientOnly) | |
| { | |
| var tempConn = InstanceFinder.ClientManager.Connection; | |
| if (tempConn != null && tempConn.IsValid) | |
| _conn = tempConn; | |
| } | |
| else if (nm.IsServerOnly || (nm.IsServer && !nm.IsClient)) | |
| { | |
| var owner = S1LandVehicle.Owner; | |
| if (owner != null && owner.IsValid) | |
| _conn = owner; | |
| } | |
| } |
S1API/Vehicles/LandVehicle.cs
Outdated
Comment on lines
128
to
136
| private void _setIsPlayerOwned(bool isPlayerOwned) | ||
| { | ||
| S1LandVehicle.SetIsPlayerOwned(_conn, isPlayerOwned); | ||
| // make sure to add/remove the vehicle from the player owned vehicles list | ||
| if (isPlayerOwned) | ||
| NetworkSingleton<S1Vehicles.VehicleManager>.Instance.PlayerOwnedVehicles.Add(S1LandVehicle); | ||
| else | ||
| NetworkSingleton<S1Vehicles.VehicleManager>.Instance.PlayerOwnedVehicles.Remove(S1LandVehicle); | ||
| } |
Collaborator
There was a problem hiding this comment.
Suggested change
| private void _setIsPlayerOwned(bool isPlayerOwned) | |
| { | |
| S1LandVehicle.SetIsPlayerOwned(_conn, isPlayerOwned); | |
| // make sure to add/remove the vehicle from the player owned vehicles list | |
| if (isPlayerOwned) | |
| NetworkSingleton<S1Vehicles.VehicleManager>.Instance.PlayerOwnedVehicles.Add(S1LandVehicle); | |
| else | |
| NetworkSingleton<S1Vehicles.VehicleManager>.Instance.PlayerOwnedVehicles.Remove(S1LandVehicle); | |
| } | |
| private void SetIsPlayerOwned(bool isPlayerOwned) | |
| { | |
| S1LandVehicle.SetIsPlayerOwned(_conn, isPlayerOwned); | |
| // make sure to add/remove the vehicle from the player owned vehicles list | |
| if (isPlayerOwned) | |
| NetworkSingleton<S1Vehicles.VehicleManager>.Instance.PlayerOwnedVehicles.Add(S1LandVehicle); | |
| else | |
| NetworkSingleton<S1Vehicles.VehicleManager>.Instance.PlayerOwnedVehicles.Remove(S1LandVehicle); | |
| } |
S1API/Vehicles/LandVehicle.cs
Outdated
Comment on lines
151
to
163
| private void _setColor(VehicleColor color) | ||
| { | ||
| var setOwnedColorMethod = | ||
| typeof(S1Vehicles.LandVehicle).GetMethod("SetOwnedColor", | ||
| BindingFlags.Instance | BindingFlags.NonPublic); | ||
| if (setOwnedColorMethod == null) | ||
| { | ||
| Logger.Error("SetOwnedColor method not found!"); | ||
| return; | ||
| } | ||
|
|
||
| setOwnedColorMethod.Invoke(S1LandVehicle, [_conn, (S1Vehicles.Modification.EVehicleColor)color]); | ||
| } |
Collaborator
There was a problem hiding this comment.
Suggested change
| private void _setColor(VehicleColor color) | |
| { | |
| var setOwnedColorMethod = | |
| typeof(S1Vehicles.LandVehicle).GetMethod("SetOwnedColor", | |
| BindingFlags.Instance | BindingFlags.NonPublic); | |
| if (setOwnedColorMethod == null) | |
| { | |
| Logger.Error("SetOwnedColor method not found!"); | |
| return; | |
| } | |
| setOwnedColorMethod.Invoke(S1LandVehicle, [_conn, (S1Vehicles.Modification.EVehicleColor)color]); | |
| } | |
| private void SetColor(VehicleColor color) | |
| { | |
| var setOwnedColorMethod = | |
| typeof(S1Vehicles.LandVehicle).GetMethod("SetOwnedColor", | |
| BindingFlags.Instance | BindingFlags.NonPublic); | |
| if (setOwnedColorMethod == null) | |
| { | |
| Logger.Error("SetOwnedColor method not found!"); | |
| return; | |
| } | |
| setOwnedColorMethod.Invoke(S1LandVehicle, [_conn, (S1Vehicles.Modification.EVehicleColor)color]); | |
| } |
S1API/Vehicles/LandVehicle.cs
Outdated
| /// <summary> | ||
| /// Logger for the LandVehicle class. | ||
| /// </summary> | ||
| private static readonly Log Logger = new Log("S1API.LandVehicle"); |
Collaborator
There was a problem hiding this comment.
Suggested change
| private static readonly Log Logger = new Log("S1API.LandVehicle"); | |
| private static readonly Log _logger = new Log("S1API.LandVehicle"); |
MaxtorCoder
requested changes
May 20, 2025
MaxtorCoder
approved these changes
May 22, 2025
Collaborator
|
Thanks for the PR, I will fix any further issues with build :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a simple way to spawn and customize vehicles with S1API.
Example: