Created
December 22, 2010 06:17
-
-
Save apathyboy/751171 to your computer and use it in GitHub Desktop.
Psuedo code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Scripting environment is supplied with the object id and invoking message | |
include 'components' | |
// Set up global data properties for this script. | |
properties.burst_run_modifier = 2; | |
properties.cooldown_delay_sec = 60; | |
properties.effect_duration_sec = 300; | |
// Check the state component to see if the running state is already set | |
if (state_component().locomotion = Locomotions::RUNNING)) { | |
// Posting a message allows some components, such as player, to do things | |
// like send a system message. | |
object_manager.postMessage("already_burst_running"); | |
return false; | |
} | |
// Check the command component to see if it has a cooldown set for this command still | |
if (command_component().hasCooldown("burst_run")) { | |
object_manager.postMessage("cooldown_timer_not_expired"); | |
return false; | |
} | |
// All the checks passed! Trigger a burst run event on the object. | |
object_manager.postMessage("burst_run", properties); | |
// Return the speed back to normal with a delayed event. | |
object_manager.postMessage("burst_run_end", properties.effect_duration_sec, properties); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment