#include #include #include "../include/swserv-plugins.h" /* * SWServ Plugin hit notify. * * This function is called whenever an object has been hit. * * The wobj_num is the object that caused the hit (called the * weapon object). * * The tobj_num is the object that received the hit (called the * target or victim object). * * The dmg_total is the total amount of damage calculated by * dmg_hull + dmg_shield. * * The bearing is the bearing in radials from tobj_num to * wobj_num, this indicates the direction that the tobj_num was * hit from. * * The dmg_hull is the damage to the target object's hull. * * The dmg_shield is the damage to the target object's shield. */ SWPLUGIN_HIT_NOTIFY_FUNCRTN SWPLUGIN_HIT_NOTIFY_FUNC( int wobj_num, int tobj_num, float dmg_total, float bearing, float dmg_hull, float dmg_shield, SWServContext *ctx ) { xsw_object_struct *wobj = SWServObjectGetPointer(ctx, wobj_num), *tobj = SWServObjectGetPointer(ctx, tobj_num); if((tobj != NULL) && (wobj != NULL)) { printf( "`%s' hit by `%s'.\n", tobj->name, wobj->name ); } else if(tobj != NULL) { printf( "`%s' hit by unknown object.\n", tobj->name ); } } /* * SWServ Plugin initialize. */ SWPLUGIN_INIT_FUNCRTN SWPLUGIN_INIT_FUNC(SWPLUGIN_INIT_FUNCINPUT) { return(0); } /* * SWServ Plugin manage. */ SWPLUGIN_MANAGE_FUNCRTN SWPLUGIN_MANAGE_FUNC(SWPLUGIN_MANAGE_FUNCINPUT) { return(0); } /* * SWServ Plugin shutdown. */ SWPLUGIN_SHUTDOWN_FUNCRTN SWPLUGIN_SHUTDOWN_FUNC(SWPLUGIN_SHUTDOWN_FUNCINPUT) { return; }