
Macro.add('pain', {
	handler  : function () {
		try {
			let bodypartId:string, reason:string, value:number;
            if(this.args.length == 2){
                reason = '';
                [bodypartId,value] = this.args;
            }else if(this.args.length == 3){
                [bodypartId,reason,value] = this.args;
            }else
                throw new Error(`Unsupported number of arguments in widget pain :${this.args.length}`);

            if(!(setup.hasBodypart(bodypartId)))
                throw new Error(`Unreckognized bodypart in widget pain :${bodypartId}`);

            State.variables.pc.painInc(bodypartId,reason,value);
		}
		catch (ex) {
			return this.error('ERROR in pain-widget: ' + ex.message);
		}
	}
});