Development > Newbie Coding

Encumbrance/TU penalty

<< < (4/6) > >>

Kildor:
cheater, cheater!!

Thrashard96:
;D good one, have you read my signature below?

DarkRain:

--- Quote from: Duke on August 31, 2010, 10:57:39 pm ---Do you think you can provide a little patch that makes auto placing call onChange ?

--- End quote ---
Well, Itried a little to work that out but it didn't work quite as expected, so I ended calling the update function right there, at least for now
Still that might be something worth checking as I'm not sure it was *only* an error on my side, as it seemed to work for all container nodes besides the backpack (where it crashed the game), will look at it later -- I'm in my other PC right now

--- Quote ---
Do you think you found all the events ?

--- End quote ---
Not yet, I'm aware of at least a couple situations that will throw things out of sync...


--- Quote ---@keybounce:
DarkRain's implementation will apply the penalties in the most gradual way possible. So it's not like overloaded ? TUs -= 20%.

--- End quote ---
That's right I'm using an exponential function to calculate the penalty so it will progress slowly -- at the begining -- but if you seriously overload your soldiers they might end crushed under the weight of their equipment (but I'm talking of something like the double or more than they should carry) ;D

DarkRain:

--- Quote from: Duke on August 31, 2010, 10:57:39 pm ---Do you think you can provide a little patch that makes auto placing call onChange ?

--- End quote ---
Maybe something like the attached patch could do the trick -- not very elegant tough.

bayo:
Hi, i dont read the problematic, and i dont have the full code here, anyway.

Some comments:

* please move assignation like "target = csi.idHolster" outside of param. (cause i dislike interleave like that (to me, it is hard to read, i prefer more lines, its the same for assignation inside if...).

* move UI_GetContainerNodeByContainerID to ui_node_container.c and .h

* first UI_GetContainerNodeByContainerID param should be a parent node (or a window node). UI_GetContainerNodeByContainerID (const uiNode_t* const parent... then u can use it like that UI_GetNode(parent, "holster"), and like that UI_GetContainerNodeByContainerID(node->parent, ...). We assume all containers have the same parent, it can be a panel (not only a window). Anyway it can be a deeper search, cause we dont call a lot this function.

* use a switch instead of the "if"s for UI_GetContainerNodeByContainerID. Better, check UI_ContainerNodeLoaded, we should use something like INVSH_GetInventoryDefinitionByID (namebyid, this name is hard coded somewhere (or in a script), we should not hardcode it another time). Also, "equip" is a little special (see UI_ContainerNodeLoaded), but battlescape only only use "equip" without sufix ATM. See the last note.

* Just a note, baseinventory is only used outside battlescape. And ATM only "equip_" is used outside the battlescape.

Anyway, sorry, the container code is very very bad ATM, and hard to clean.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version