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

Added some features #9

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Added some features #9

wants to merge 8 commits into from

Conversation

gabidut
Copy link

@gabidut gabidut commented Dec 23, 2023

  • DashboardNeedle
    • For RPMs and speed
  • Better speed-display
    • Gear
    • Speed
    • Speed limit

Copy link
Member

@AymericBdy AymericBdy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merci pour ta pull-request, par contre il y a plusieurs trucs à modifier avant que ça soit intégré au BasicsAddon.

Copy link
Contributor

@YanisBDF YanisBDF left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bonne feature mais quelques soucis de code 👍

The `DetailToShow` can be one of the following:
- GEAR
- SPEED
- SPEEDLIMITOR
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SPEED_LIMITER*

- SPEED
- SPEEDLIMITOR

It will display the current gear, speed or speedlimitor value at the position.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ça veut pas dire grand chose "CarStartedReact"

Comment on lines +77 to +96
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;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lombok

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Utilise un Vector3f please

Comment on lines +53 to +71
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;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lombok

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()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tu peux utiliser une condition ternaire et peut être utiliser Integer.MAX_VALUE au lieu de 100000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants