These are some patches I made for Eisenstern (Sauerbraten engine). The primary goal is to make almost everything that's currently hardcoded scriptable with CubeScript.
They are based on Sauerbraten CVS as of 2008-05-29. Apply with "patch -p1" from within src directory.
r_get_name to get name of object on top of RPG stack.r_check_inv to check if object on top of RPG stack has a given item in inventorysilent to commands r_take and r_give to suppress console outputr_{add,check,del}_{enemy,friend}.
Used for attacking, needs changes to game_rpg.cfg (add "r_aigroup x" for each "r_ai x").r_pop.r_state and r_get_state to get/set entity state (e.g. for reviving NPCs).r_{x,y,z} and
r_get_{x,y,z} to get/set entity coordinates (e.g. to ensure revived
entities don't get stuck in their dropped loot).r_get_model to determine model for object on top of RPG stack.r_modelr_push_player to push player object on top of RPG stack.r_del_action to remove a given NPC action or quest from the GUI menu (but not from the quest log).
Does not free memory, but most struct members are only references to the string pool anyway. Deliberate design decision,
but good arguments might convince me otherwise.r_loop_inrange to loop over entities within a given range. Current entity is pushed onto
RPG stack (so it can be used from within CubeScript) and popped back (so the parent objects remain accesible) for each
iteration.r_attack to let stack[1] attack stack[0], e.g. from within r_loop_inrange.r_rotate to let object on top of RPG stack rotate towards a given angle (absolute).r_turnto to let stack[1] turn to face stack[0], e.g. from within r_loop_inrange.r_move to let object on top of RPG stack start/stop moving. Needs better AI type support
to work properly (otherwise it's overridden by hardcoded NPC logic).r_loop_inv to loop over inventory objects of given type (0 means everything). Works like
r_loop_inrange.r_use usable for NPCs. Changes (automatic) weapon selection for player slightly.r_get_blocked and r_blocked to get/reset attribute "blocked".r_get_targetyaw (opposite of r_rotate).r_enemy (set top of stack as enemy of top-1) and r_push_enemy (put enemy of top of stack on top of stack)r_push_weapon (put current weapon of top of stack on top of stack)r_npcstate and r_get_npcstate to get/set npcstate attribute of top of stack.r_dist to determine distance between top of stack and top-1.r_get_dispname and r_dispname to get/set name displayed in GUI (defaults to
spawn name).blood and bloodfade to toggle blood resp. change blood fade speed. Useful for
older graphics cards.r_vecyaw to determine angle (yaw) to given position (e.g. home).r_say) as end-of-line, i.e. add support for multi-line texts.