Pushing

From The DarkMod Wiki
Jump to navigationJump to search

The player is allowed to push things around in the world, provided they are set up as Moveables. Depending on their mass the objects are considered as lightweight or heavy.

Lightweight objects are kicked as soon as the player runs into them. Heavy objects will stop the player's movement and will require steady pushing before they start to move. The player will have to push against that moveable for a certain amount of time before it slowly starts to accelerate and emits a sliding sound. The maximum velocity of that pushed object depends on the player's walk speed and the object's mass. There is a fixed value (200 kg at the time of this writing), above which entities cannot be pushed by the player.

Spawnargs

To disallow pushing of heavy objects, add the spawnarg

"notPushable" "1"

on that entity. Note that this applies only for "heavy" objects.

To allow for pushing of objects the player would not be able to push under normal conditions, the support for a push-modifier has been added. Define the spawnarg

"push_mod" "3" // the correct value depends on the mass and your needs

on the entity being pushed. For instance, a 400 kg object can be pushed with a push_mod value of 3.

Moveables will play a sound when being pushed, this is defined by the snd_sliding spawnarg:

"snd_sliding" "<SOUND SHADER HERE>"

CVARS

  • pm_push_start_delay defines the delay in msecs before heavy things get pushed by the player. Default is 1000 msecs.
  • pm_push_accel_time defines the acceleration time in msecs when the player is starting to push things. After this time has passed, the pushed object has reached its maximum possible velocity. Default is 1000 msecs.
  • pm_push_heavy_threshold defines the fraction of the player mass, above which pushable things are considered as 'heavy'. Default is 0.75.
  • pm_push_max_mass defines the maximum mass in kg a moveable can have to be pushable at all. Default is 200 kg.
  • pm_pushmod only applies for lightweight objects (below 75% of the player mass, see pm_push_heavy_threshold). The kick force of the player is multiplied with this factor.