Hey Maebius (and kid!),
Got a chance to look, here is what I found:
1. When I hit control to attack, seemed like nothing was happening. So I added a LogMsg("Doing attack"); to the top of ProcessAttack() so I could hit ~ and see in the log that the function was actually running.
2. It wasn't. So there's the problem.. so why not? Well, in the script, it does properly run this:
But that doesn't really do anything except set m_bAttack to true .. which you need to notice in the Update() function to do the "real attack". It's good to do it this way because you always know exactly in which order things like swinging, jumping, will happen, rather than doing them when the key is actually hit.
if (bKeyDown) then
m_bAttack = true;
So to make it actually call ProcessAttack() I changed player.lua's update to look like this: (I only added stuff to the bottom)
After that, my LogMsg() function was hit and it actually does something. It makes a swing noise and gives an error about the visual not being there.. but you knew that would happen.
//this is run every logic tick, normally we don't need to do this, but the player is a special case
AssignPlayerToCameraIfNeeded(this); //make us the official player and have the camera track us,
//if we're not already, and if another entity doesn't already have this role
//this function is in player_utils.lua
local facing = ConvertKeysToFacing(m_bLeft, m_bRight, m_bUp, m_bDown);
if (facing != C_FACING_NONE) then
//they are pressing towards a direction
this:SetFacingTarget(facing); //turn towards the direction of the keys we pressed
//Seth's new stuff below here!
if (m_bAttack) then
//looks like they hit the attack button, let's do that now.
m_bAttack = false; //so we don't keep attacking until they hit the button again