Skip to content

Instantly share code, notes, and snippets.

class script {
scene@ g;
textfield@ txt;
int init_filth;
int init_filth_block;
int init_enemy;
script() {
@g = get_scene();
@msg555
msg555 / sounddemo.cpp
Created October 20, 2017 18:46
An example of how to embed and use custom sounds with dustscripting.
const string EMBED_sound1 = "test1.ogg";
class script {
scene@ g;
script() {
@g = get_scene();
}
void build_sounds(message@ msg) {
@msg555
msg555 / sprite_example.cpp
Last active October 12, 2017 17:23
An example of how to embed, build, and use custom sprites with dustscripts.
const string EMBED_test1 = "test1.png";
const string EMBED_test2 = "test2.png";
class script {
int frame_count;
sprites@ spr;
script() {
frame_count = 0;
@spr = create_sprites();
class script {
scene@ g;
int frame;
script() {
@g = get_scene();
frame = 0;
}
void step(int entities) {
@msg555
msg555 / audio.txt
Created August 4, 2017 00:38
Audio names in DF
All Stream Names
amb_birds
amb_hollow
amb_city
amb_crickets
amb_wind
amb_machinery
amb_computers
amb_rain
const int MAX_PLAYERS = 4;
class script {
scene@ g;
array<controllable@> players;
script() {
@g = get_scene();
players.resize(MAX_PLAYERS);
}
@msg555
msg555 / aitest.cpp
Created July 29, 2017 16:12
Create and setup an AI controller
class script {
bool firstFrame;
script() {
firstFrame = true;
}
void step(int entities) {
if (!firstFrame) {
return;
@msg555
msg555 / sample.cpp
Created July 28, 2017 23:01
Restore air charges when player collects dust
const int MAX_PLAYERS = 4;
class script {
/* We don't actually use the scene object in this script, but most will. */
scene@ g;
/* Keep track of how much dust we had in the last frame. */
array<int> dust_last;
/* Keep track of how much dust we had when the last checkpoint was saved. */
@msg555
msg555 / proptest.cpp
Created July 28, 2017 22:59
Create a prop and move it 1 unit per frame.
class script {
/* We don't actually use the scene object in this script, but most will. */
scene@ g;
prop@ p;
int frame;
int frame_cp;
script() {
@g = get_scene();
@msg555
msg555 / entities.txt
Last active July 28, 2017 01:33
List of Dustforce entities
AI_controller
ambience_trigger
camera_node
check_point
dust_girl
dust_kid
dust_man
dustmod_entity_tool
dust_worth
dust_wraith