The most complex part of it is probably the portal matrix. Plus a triangle normal calculation and some trigonometry. I wouldn't call that complex math.
Uhuh . . . I guess if that is just everyday math, then oh well. It is still on the very outskirts of my mathematical understanding. Maybe its the water we Americans drink. Infact, only careful study of your code and adjacent footnotes gave me the ability to decifer it. Well, that and perhaps the convenient targetnames.
Note: Portals can be fired through Vehicle clip, Player clip, Weapon clip and any material labeled "$name notsolid".
Now, you speak of a BSP preprocessor. Inherently cool, but I have a few Ideas. In the Portal game, the Portals would spawn on any surface except the black metallic walls. It could be that the device would have preformed in the same manner outside of the lab. Perhaps it was only that black stuff which blocked portal spawning. A "Super" material.
To best replicate its effect, I think the script only need recognize that a portal is touching this stuff, (script_object) and to immediately close it. Something like this could be called after each shot:
Code: Select all
on_blackstuff:
if (self.prtl_blue isTouching $blackwall)
self.prtl_blue waitthread portal_close 0
if (self.prtl_yellow isTouching $blackwall)
self.prtl_yellow waitthread portal_close 0
end
I am going to see if I can check for useheld. It should be better to press "E" and be able to collapse portals. Say, if you are being chased.
According to the game's AI, the device has a value greater than the organs and incomes of all subjects in "unknown amount". Is it possible to spawn it with a count of one, (prtl.gun cnt 1?) so as to make it a rare non-respawning item?