There's a really good reason that nations should comply with international law and not do shit like deliberately put military targets in civilian buildings.
There's a really good reason that nations in armed conflict should comply with international law and not conceal military targets as medical facilities.
Why? Because doing those things makes the civilian buildings and medical facilities into legitimate military targets.
A major goal of the international law of war is to reduce civilian suffering. The rules that Hamas is breaking, are rules that exist to reduce civilian suffering -- in this case, the suffering of Palestinian civilians.
But yeah, if your foe is shooting at you from an ambulance, yes you get to take out the ambulance. If your foe is shooting rockets from a school, yes you get to take out the school. Ambulances and schools aren't supposed to be shooting at all.
But again, Hamas doesn't recognize a civilian/military distinction. This makes them a really shitty government.