How did Peter hide in plain sight from the robot, when it had heat vision? Also, the robots must have very advanced cooling systems for them to be cold.
A case of Science Marches On - most writers of the time figured robots would be "room temperature", not realizing that a lot of transistors would give off a lot of heat (less than a similar number of vacuum tubes, but still).
So then again, shouldn't sexbots be warm to the touch?
The impression I got was that the Gunslinger had the infra-red vision as a backup and only started using it when its "real" vision was damaged by the chemicals thrown in its face (it isn't shown using it before that point, and is only shown using it afterwards). The heat vision was probably designed to detect the warmest things around (i.e. the guests) and ignore everything else, so the torches in that room were significantly warmer than Peter, allowing him to remain undetected.
The scene in which they gave the robot infrared vision suggests it was nothing more than a routine upgrade, intended to make him a bit more challenging (being able to find a guest faster) as a designated adversary. Of course, when the robots went berserk, this turned out to be a feature Gone Horribly Right as he proved very challenging indeed. Incidentally, one can see him using the vision before he got burned with acid in order to track Peter's footsteps, so presumably it was intended to be used at all times.
Why does the park use real guns? They could have just put squibs in the robots or something, would have been a lot safer.
As part of the attraction to the theme parks, the guns are real to heighten the thrill of shooting someone, even if it's an artificial someone.
There's also a real reason to that. The guns use thermal sensors, hence why when John asked Peter to shoot him, it didn't work (what John exactly said, I forgot, but it had something to do with body temperature). Maybe when the park's control system went out of whack, the thermal sensors started being indiscriminate towards human and robot-kind.
What about the swords? The guns can't harm humans but what's to stop a visitor from accidentally stabbing a guest with a sword?
It's not much of a defence, but you can't exclude swords from ThemeparkMiddle Ages. The vacations were 100% about the experience, and the experience in Medieval World would be inauthentic without them.
Considering the lack of security, the technicians probably considered the danger of one guest "accidentally" stabbing another with a sword in Medieval World to be as likely as a guest "accidentally" bludgeoning another with a liquor bottle in Western World. Any object is potentially dangerous in the hands of a human being, but the main concern of the technicians was making sure they weren't potentially dangerous in the hands of a robot.
The swords could potentially have been very blunt as well, similar to the swords reenactors use, you can swing them with a lot of force and do only minor damage, therefore only the robots could be set to react to them.
The fact the robots are not waterproof or at least able to consume liquids. It seems the moment a tourist tried to share a drink with one of the robots it would immediately short circuit. This is more glaring when the viewer would have already seen some of the machines drinking. Does this indicate some had the ability whereas others didn't? Why would you make them acid resistant but not able to swim without breaking?
Perhaps the girl in the dungeon is damaged in some way. The brothel madam in Westworld is seen drinking and smoking.
For one thing, they weren't especially acid-resistant; the Gunslinger was looking very blistered indeed after he got splashed. There just wasn't that much actually thrown on him, and whichever acid Peter used, the acids shown being available to him were all "strong" acids, meaning they would not burn much beyond where they hit before the reaction was complete. ("Weak" acids can actually be more dangerous in this regard, as their reactions are never entirely complete.)
As for the drinking and waterproofing, this might well vary from one robot to another as a bit of financial corner-cutting: the capacity for eating and drinking would cost extra, so the technicians would try to have it installed only in robots that needed to do this for social reasons. Robots intended as sex bots (such as that poor girl in the dungeon) or purely for fighting (such as that black knight) wouldn't ever be called upon to eat or drink, and therefore wouldn't normally need these capacities. It's an in-universe case of They Wasted a Perfectly Good Sandwich. The Gunslinger, as part of his program, was intended to order a drink and down it as part of picking a fight, so naturally he had these capacities. So would any robots called upon to swim, though it's doubtful there were very many situations of that sort outside of Roman World with its pool parties. Otherwise, it's strictly optional and there's no money in the company's budget for it.
How did exactly the Gunslinger plan to kill Martin anyway after his gun ran out of batteries ?
He's a robot programmed to be a westerner. If he couldn't shoot his target, he would either try to hang him or beat him to death.