Both Nimoy and cinematographer Gerry Finnerman, who lost his dad while he was on location, helped Shatner get through a rather unproductive day on the set after he got the news. They then shot around him for the next few days while he was in Florida taking care of things (the shots of Kirk and the Horta are a mishmash of shots of Shatner and Shatner's stand-in).
Of course, upon his return, Shatner felt the need to prove that he was fine, so he promptly set about setting up Nimoy for public humiliation. Under the auspices of going over what went on while he was gone, Shatner had Nimoy reenact the "Pain! Pain! PAAIN!!" bit, eventually get Nimoy to scream "PAAAAAAIINN!!", at which point Shatner calls out, "For chrissakes, someone get that man an aspirin!" Nimoy wanted to strangle Shatner at that point.