1. What's the Lua command to make an unit sleep? I get that unit

Code:
unit:DoCommand(CommandType.COMMAND_WAKE);
2. I have the following code which I modified from bouncymischa's code here, where the aim is basically to make a button that would heal the unit as well as pillage a farm at the same time. However, the button is still not valid when the unit is on a farm, and I can't figure out why it doesn't work.
Code:
function CheckPillageHealButtonValidity(pPlayer, pUnit)
local iCurrentCulture = pPlayer:GetJONSCulture();
if (iCurrentCulture > 50) and (pUnit:GetPlot():GetImprovementType() == [COLOR="Red"][B]IMPROVEMENT_FARM[/B][/COLOR]) then
return true;
end
return false;
end
2nd Edit: I found the problem myself... As highlighted in bolded red above, the constant should not be just "IMPROVEMENT_FARM", but as written in the wiki, it should be "GameInfo.Improvements.IMPROVEMENT_FARM.ID". Therefore the correct code is:
Code:
function CheckPillageHealButtonValidity(pPlayer, pUnit)
local iCurrentCulture = pPlayer:GetJONSCulture();
if (iCurrentCulture > 50) and (pUnit:GetPlot():GetImprovementType() == GameInfo.Improvements.IMPROVEMENT_FARM.ID) then
return true;
end
return false;
end
*slaps forehead* silly me. We live and learn...