Conversation
gabidut
commented
Dec 23, 2023
- DashboardNeedle
- For RPMs and speed
- Better speed-display
- Gear
- Speed
- Speed limit
AymericBdy
left a comment
There was a problem hiding this comment.
Merci pour ta pull-request, par contre il y a plusieurs trucs à modifier avant que ça soit intégré au BasicsAddon.
src/main/java/fr/dynamx/addons/basics/common/infos/DashboardNeedleInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/DashboardNeedleInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/DashboardNeedleInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/DashboardNeedleInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/DashboardNeedleInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/DashboardTextInfos.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/DashboardNeedleInfo.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/DashboardTextInfos.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/SpeedDisplayInfos.java
Outdated
Show resolved
Hide resolved
src/main/java/fr/dynamx/addons/basics/common/infos/SpeedDisplayInfos.java
Outdated
Show resolved
Hide resolved
YanisBDF
left a comment
There was a problem hiding this comment.
Bonne feature mais quelques soucis de code 👍
| The `DetailToShow` can be one of the following: | ||
| - GEAR | ||
| - SPEED | ||
| - SPEEDLIMITOR |
| - SPEED | ||
| - SPEEDLIMITOR | ||
|
|
||
| It will display the current gear, speed or speedlimitor value at the position. |
There was a problem hiding this comment.
speed limiter aussi du coup
|
|
||
| It will display the current gear, speed or speedlimitor value at the position. | ||
|
|
||
| The `CarStartedReact` can be `True` or `False` and will enable or disable the display when the car is started. |
There was a problem hiding this comment.
ça veut pas dire grand chose "CarStartedReact"
| public int getNeedleMaxTurn() { | ||
| return needleMaxTurn; | ||
| } | ||
|
|
||
| public int getDashboardMaxValue() { | ||
| return dashboardMaxValue; | ||
| } | ||
|
|
||
| public EnumDashboardNeedleType getNeedleType() { | ||
| return needleType; | ||
| } | ||
|
|
||
| public Vector3f getRotation() { | ||
| return rotation; | ||
| } | ||
|
|
||
| public String getNodeDependingOnName() { | ||
| return this.nodeDependingOnName; | ||
| } | ||
|
|
There was a problem hiding this comment.
Précision : il est pas configuré sur l'env du BasicsAddon, donc on l'ajoutera surement nous-mêmes
| if (entityRenderContext.getModel().containsObjectOrNode(DashboardNeedleInfo.this.getObjectName()) && entity.getModuleByType(CarEngineModule.class) != null && DashboardNeedleInfo.this.getPosition() != null) { | ||
| GlStateManager.pushMatrix(); | ||
| Vector3f pos = DashboardNeedleInfo.this.getPosition(); | ||
| GL11.glTranslatef(pos.x, pos.y, pos.z); |
There was a problem hiding this comment.
GlStateManager au lei de GL11
| TextUtils.makeGLRotation(getRotation()); | ||
| switch (DashboardNeedleInfo.this.getNeedleType()) { | ||
| case RPM: | ||
| int rpms = Math.round(entity.getModuleByType(CarEngineModule.class).getEngineProperty(VehicleEntityProperties.EnumEngineProperties.REVS) * 10000); |
There was a problem hiding this comment.
Tu peux faire une variable interne de entity.getModuleByType(CarEngineModule.class) et l'utiliser plusieurs fois au lieu de rappeler chaque fois
| protected boolean carStartedReact; | ||
|
|
||
| @PackFileProperty(configNames = "Color", description = "common.color", required = false) | ||
| protected int[] color = new int[]{10, 10, 10}; |
There was a problem hiding this comment.
Utilise un Vector3f please
| public Vector3f getRotation() { | ||
| return rotation; | ||
| } | ||
|
|
||
| public int[] getColor() { | ||
| return color; | ||
| } | ||
|
|
||
| public boolean isCarStartedReact() { | ||
| return carStartedReact; | ||
| } | ||
|
|
||
| public String getFont() { | ||
| return font; | ||
| } | ||
|
|
||
| public EnumDashboardTextType getDetailToShow() { | ||
| return detailToShow; | ||
| } |
| public void render(@Nullable T entity, EntityRenderContext entityRenderContext, A packInfo) { | ||
| if (entity == null) return; | ||
| if (DashboardTextInfos.this.getRotation() != null) { | ||
| if (entity.getModuleByType(CarEngineModule.class).getPhysicsHandler().getEngine().isStarted() && DashboardTextInfos.this.isCarStartedReact()) { |
There was a problem hiding this comment.
Meme chose pour entity.getModuleByType(CarEngineModule.class)
| break; | ||
| case SPEEDLIMITOR: | ||
| int tempvalue = Math.round(entity.getModuleByType(CarEngineModule.class).getSpeedLimit()); | ||
| if (tempvalue != 0 & tempvalue < 10000000) value = String.valueOf(tempvalue); |
There was a problem hiding this comment.
tu peux utiliser une condition ternaire et peut être utiliser Integer.MAX_VALUE au lieu de 100000