-
Notifications
You must be signed in to change notification settings - Fork 10
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
@1 Car= | ||
@1 Hovercraft= | ||
@1 Mesecar= |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
Thanks for the reviews, will check this out when I have time. 🙂 |
No description provided.