Not logged inOpenClonk Forum
Up Topic General / Help and Questions / Some Questions about Source Code
- - By Anonymous Date 2015-11-15 01:43
Hi,

I am trying to get a general gist on how the source code works, specifically in finding out the exact file/function that deals with

1) the movement speed of shoveling underground
2) the speed of cutting down a tree
3) the attack speed of the bow. 

Relating to 2) 3)
From what I searched, it seems like the function/classes involved in player movement is under master/src/control/C4PlayerControl.cpp
the ExecuteControl() and Execute() functions are related to judging when the keys are being pressed down and doing the action, but where would the info be about specifically
the object axe, and executing axe moves to cut tree?  Or the executing bow and arrow?

Relating to 1)
https://git.openclonk.org/openclonk.git/blob/refs/heads/master:/src/object/C4Movement.cpp
Under src/object/C4Movement.cpp, I see the function DoMovement()...  Is this the code for shoveling underground?

Thank you in advance
Reply
Parent - By Zapper [de] Date 2015-11-15 08:10
I don't think you'll have to dig that deep into the engine to do whatever you want.
Most of the control stuff is in script nowadays.

Shoveling speed:
General speed: https://git.openclonk.org/openclonk.git/blob/HEAD:/planet/Objects.ocd/Clonk.ocd/Script.c#l867
The speed change during digging: https://git.openclonk.org/openclonk.git/blob/HEAD:/planet/Objects.ocd/Items.ocd/Tools.ocd/Shovel.ocd/Script.c#l131

Tree-cutting speed:
The speed is determined by how quickly the necessary damage is dealt to the tree. The damage is determined by Axe.ChopStrength, as outlined here:
https://git.openclonk.org/openclonk.git/blob/HEAD:/planet/Objects.ocd/Items.ocd/Tools.ocd/Axe.ocd/Script.c#l207

The bow stuff (or aiming in general) is handled by our aim manager library. The bow just tells the library how it wants to be treated here:
https://git.openclonk.org/openclonk.git/blob/HEAD:/planet/Objects.ocd/Items.ocd/Weapons.ocd/Bow.ocd/Script.c#l32
Up Topic General / Help and Questions / Some Questions about Source Code

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill