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

Short and improve the code and texture names #20

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

Conversation

Panquesito7
Copy link
Member

No description provided.

@Panquesito7 Panquesito7 added the enhancement New feature or request label Sep 7, 2023
Copy link
Member

@SmallJoker SmallJoker left a comment

Choose a reason for hiding this comment

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

The hovercraft.lua comments also apply to the other files.

vehicles/hovercraft.lua Outdated Show resolved Hide resolved
vehicles/hovercraft.lua Outdated Show resolved Hide resolved
@Panquesito7 Panquesito7 requested a review from SmallJoker October 4, 2023 18:48
Comment on lines +9 to +11
@1 Car=
@1 Hovercraft=
@1 Mesecar=
Copy link
Member

Choose a reason for hiding this comment

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

I am sure this will not translate well in some languages where the adjective (blue, white, green) may depend on the gender of the noun.

-- These types of car do not have an inventory image.
if color == "road_master" then
def.inventory_image = "inv_car_brown.png"
def.wield_image = "inv_car_brown.png"
Copy link
Member

@SmallJoker SmallJoker Nov 25, 2023

Choose a reason for hiding this comment

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

Idea: you could make use of a definition table above. It will be a bit verbose but very easy to scale without special code handling.

local types = {
	black = { desc = S("Black car") }, -- defualt color "black"
	...
	road_master = { desc = S("Road master car"), color = "brown" } -- override color: "brown"
	...
}

...

for name, car in ipairs(types) do
	...
	def.description = car.desc;
	def.inventory_image = ("inv_car_%s.png"):format(car.color or name)
	...

Bonus: at the same time this also solves any translation issues.

local capitalization = color:gsub("^%l", string.upper)
local style = capitalization:gsub("_", " ")

def.description = vehicle_mash.S("@1 Car", style)
Copy link
Member

@SmallJoker SmallJoker Nov 25, 2023

Choose a reason for hiding this comment

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

This produces outputs like Dark Green voiture in French because the color is not translated and not picked up by the translation generator script. For a clean solution, see the comment below (or above in the review) stating the definition table idea.

@Panquesito7
Copy link
Member Author

Thanks for the reviews, will check this out when I have time. 🙂

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

Successfully merging this pull request may close these issues.

2 participants