Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upAttach/detach mod #8335
Conversation
narc0tiq
reviewed
Jul 26, 2014
| @@ -1321,9 +1431,10 @@ void veh_interact::display_mode(char mode) | |||
| enabled[4] = !cant_do('s'); | |||
| enabled[5] = !cant_do('d'); | |||
| enabled[6] = !cant_do('c'); | |||
| enabled[7] = true; // 'rename' is always available | |||
| enabled[7] = true; | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
narc0tiq
Jul 26, 2014
Contributor
@Reaper42 said:
No, because there is not checks part in it.
Huh? I have no idea what you mean.
Look, I know there's a language barrier here, but I really can't tell what you're trying to say. My first guess was that you meant cant_do('t') doesn't have any checks in it, but of course it does. Your diff shows:
@@ -383,6 +386,11 @@ task_reason veh_interact::cant_do (char mode)
...
+ case 't': // attach/detach
+ enough_morale = g->u.morale_level() >= MIN_MORALE_CRAFT;
+ valid_target = cpart >= 0;
+ has_tools = has_wrench || can_remove_wheel;
+ break;That's something you wrote, so of course you're aware of it. It can't be what you were trying to tell me.
There was a second way I could parse it -- as a claim that setting enabled[7] doesn't make any difference. But it does:
for (size_t i = 0; i < actions.size(); i++) {
shortcut_print(w_mode, 0, pos[i] + spacing * i + shift,
enabled[i]? c_ltgray : c_dkgray, enabled[i]? c_ltgreen : c_green,
actions[i]);
}It's technically feasible you'd missed that enabled[i] is used to determine whether it shows as "active" (light gray with light green accelerator key) or "inactive" (dark gray with dark green accelerator key). On the other hand, you were looking at that code fairly recently, and you must've noticed it, so in all honesty I can't imagine that's what you were trying to tell me, either.
So, since I've clearly failed to understand what you meant, would you be willing to try rephrasing?
This comment has been minimized.
This comment has been minimized.
|
We don't need a second copy of do_install() that works slightly differently, what we need is a set of requirements for installing/removing parts, similar to the crafting and construction systems. |
This comment has been minimized.
This comment has been minimized.
Why not? You have change wheel code, it work like do_install() and do_remove() but "slightly differently". Why you can change wheel but can't change battery?
First: explain this. |
This comment has been minimized.
This comment has been minimized.
|
@kevingranade : "what we need is a set of requirements for installing/removing parts, similar to the crafting and construction systems" I thought @BevapDin did something like that? |
This comment has been minimized.
This comment has been minimized.
|
@Zireael07 he extracted the requirements thing from crafting.cpp so it can be used more easily, but he didn't go through the vehicle parts and add requirements to them, or update the vehicle construction code to use them, that's what still needs to happen. Essentially, we need a new "construct/remove vehicle part recipe", and the vehicle construction code should use that to handle tool requirements and such. |
This comment has been minimized.
This comment has been minimized.
|
Vehicle modification uses a complete different set of requirements, not compatible with what recipes/constructions use. For example installing needs:
Recipes use a structure like this:
The fact that you need welding goggles, only when using the welder (and not when using the toolbox/duct tape) can not be modeled by this. @Reaper42 Setting the part-hp to 0 is problematic when the part gets damaged further, it will break from the vehicle and give back items (see vehicle::damage_direct), even through there is actually no part there. |
This comment has been minimized.
This comment has been minimized.
|
For the welding goggle thing in particular, that could be a specific override enforced in the vehicle assembly code. If we use the welder quality, we also need eye protection. |
This comment has been minimized.
This comment has been minimized.
|
@BevapDin |
Reaper42 commentedJul 26, 2014
I can't add json entity to keybindings.json.
Mod add possibility to attach/detach parts with "ATTACH" flag with wrench and wheels with wrench and jack. After removing vehicle part become slot for part.