I want a forklift in my game that the player can drive (once the NPC driver is removed) and use to pick up and move objects. I want to be able to load the objects onto racking, place them in marked loading zones and also put them near things. I also wanted it to be a futuristic forklift with a tractor beam instead of forks, but couldn’t manage it.
My stripped down code is:
"Forklift example" by me
The forklift is in the warehouse. The forklift is a vehicle.
The description of the forklift is "A battered old electric forklift."
[Rule for printing ther name of the forklift (this is the omit contents in forklift rule):
omit contents in listing;
continue the action.]
The forklift can be heavily laden, laden or unladen.
The forklift is unladen.
An object can be heavy or light.
The tines are part of the forklift. The tines are a supporter.
The mast control is part of the forklift. The mast control can be set to raised or lowered.
The seat is part of the forklift. The seat is an enterable supporter. The seat can be occupied or unoccupied.
Understand "forks" as the tines.
Definition: The forklift is heavily laden rather than laden or unladen if a heavy thing is on the tines.
Definition: The forklift is laden rather than unladen or heavily laden if a light thing is on the tines.
Instead of taking a heavy thing when the player is in the unladen forklift: say "You lift [the noun] with the forklift."; now the noun is on the tines.
Understand the command "drive" as "go".
Definition: a thing is liftable if it is not the forklift.
Lifting it with is an action applying to two things.
Understand "lift [something liftable] with [the forklift]" as lifting it with.
Understand "lift [something liftable] with [something]" as lifting it with.
Carry out lifting something with the forklift:
say "You drive the forklift up close to [the item], slide the tines underneath, and lift it easily, if not far, into the air.";
now thw forklift is laden; [test to see if heavily laden]
now the item is part of the forklift.
After printing the name of the forklift while taking inventory:
if something is part of the forklift, say "(carrying [the list of things which are part of the forklift])".
The loading dock is east of the warehouse. The shipping container is here. The shipping container is heavy. The shipping container is liftable.
The unloading zone is a container in the warehouse. The unloading zone is scenery. [To fix: Container placed in zone becomes invisible]
My first thought is that you could simplify this a whole lot by making a rideable vehicle called a forklift, then an adjective applied to heavy items like “weighty”.
Write rules so the player cannot take “weighty” items unless they player is on the forklift. Perhaps they can also not take things that are “not weighty” if they are on the forklift. If the player is holding a weighty item and gets off the forklift, create a rule so weighty items are automatically moved to the location. (Or, if necessary, you can move a “weighty” item onto the forklift when the player disembarks, and then back into their inventory when they climb back on.) Define and redirect TAKE SOMETHING WITH FORKLIFT and DROP SOMETHING WITH FORKLIFT to just TAKING and DROPPING, and write refusal messages like “You’ll need to be on a forklift to take that.” Make LIFT and LOWER a synonym for taking and dropping. If necessary, limit the player to holding only one weighty thing as long as they are on the forklift.
What this basically does is make it easier for you and the player - you don’t have to goof with new vocabulary and multiple forklift parts, and the player can just simply PICK UP MASSIVE CRATE when they are on the forklift. The game thinks the player is holding the item so it’s kind of a cheat, but you’re not going to let them keep heavy items if they disembark the vehicle. The player can just take and drop heavy things naturally while on the forklift without learning new verbs, or how to actually drive a forklift.
It also much simplifies things like PUT MASSIVE CRATE ON PLATFORM (while on the forklift). You can define a relation “near” so then it’s just PUT MASSIVE CRATE NEAR OTHER MASSIVE CRATE and much easier if you have a stacking puzzle with supporters PUT SOMEWHAT MASSIVE CRATE ON EXTREMELY MASSIVE CRATE because you don’t have to deal with anything else except how it would work if the player were just doing it with their hands.
If this doesn’t jibe with your worldbuilding, you could always think of it like one of those mech-loaders that Ripley uses in ALIENS…where she’s essentially just picking up and dropping things with massive machine-aided strength. In that case, you could just have the player WEAR THE MECH LOADER to simplify things further.
I think Hanon’s ideas are sound. Two minor things are that you probably don’t have to make a rideable vehicle rather than a vehicle–I think the difference is just whether you ride on or in the vehicle, and riding in the forklift is OK. Also you probably would want some kind of inventory listing modification so that the heavy thing shows up as “being held by the forklift” or something. Also also, you’d probably want to prohibit the player from exiting the forklift while holding something heavy… or if you wanted to let the forklift be exited while it’s holding something heavy, you probably do have to implement the whole forklift.
Mostly I wanted to say that if you’re going to have a forklift and an NPC driver you should implement these shirts. And it’s going to be tough to remove the NPC driver! Forklift operators are hardcore!
More seriously, it seems like there’s a whole forklift operator culture that might be interesting.