X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fmonsters%2Fsv_monsters.qh;h=59d8cbd973f9b144d63f527881651499542d9581;hp=239db02bd225cb3928453f7ca4bef8f4133209e7;hb=068324d293df795dbc41de75f38256b8c6c35607;hpb=34ddb935433f04eb7679c27ec17fae9bc2541c0d diff --git a/qcsrc/common/monsters/sv_monsters.qh b/qcsrc/common/monsters/sv_monsters.qh index 239db02bd..59d8cbd97 100644 --- a/qcsrc/common/monsters/sv_monsters.qh +++ b/qcsrc/common/monsters/sv_monsters.qh @@ -1,52 +1,102 @@ -.string spawnmob; -.float monster_attack; - -.entity monster_owner; // new monster owner entity, fixes non-solid monsters - -.float stat_monsters_killed; // stats -.float stat_monsters_total; -float monsters_total; -float monsters_killed; -void monsters_setstatus(); // monsters.qc -.float monster_moveflags; // checks where to move when not attacking +#ifndef SV_MONSTERS_H +#define SV_MONSTERS_H + +// stats networking +.int stat_monsters_killed; +.int stat_monsters_total; +int monsters_total; +int monsters_killed; + +// monster properties +.int monster_movestate; // move target priority +.entity monster_follow; // follow target +.float wander_delay; // logic delay between moving while idle +.float wander_distance; // distance to move between wander delays +.float monster_lifetime; // monster dies instantly after this delay, set from spawn +.float attack_range; // melee attack if closer, ranged attack if further away (TODO: separate ranged attack range?) +.float spawn_time; // delay monster thinking until spawn animation has completed +.bool candrop; // toggle to allow disabling monster item drops +.int monster_movestate; // will be phased out +.int monster_moveflags; +.string oldtarget2; // a copy of the original follow target string +.float last_trace; // logic delay between target tracing +.float last_enemycheck; // for checking enemy +.float anim_finished; // will be phased out when we have proper animations system +.vector monster_moveto; // custom destination for monster (reset to '0 0 0' when you're done!) +.vector monster_face; // custom looking direction for monster (reset to '0 0 0' when you're done!) +.float speed2; // run speed +.float stopspeed; +.int oldskin; +.string mdl_dead; // dead model for goombas + +#define MONSTER_SKILLMOD(mon) (0.5 + mon.monster_skill * ((1.2 - 0.3) / 10)) + +// other properties +.bool monster_attack; // indicates whether an entity can be attacked by monsters + +// monster state declarations +const int MONSTER_MOVE_FOLLOW = 1; // monster will follow if in range, or stand still +const int MONSTER_MOVE_WANDER = 2; // monster will ignore owner & wander around +const int MONSTER_MOVE_SPAWNLOC = 3; // monster will move to its spawn location when not attacking +const int MONSTER_MOVE_NOMOVE = 4; // monster simply stands still +const int MONSTER_MOVE_ENEMY = 5; // used only as a movestate +const int MONSTER_ATTACK_MELEE = 6; +const int MONSTER_ATTACK_RANGED = 7; + +// skill declarations +const int MONSTER_SKILL_EASY = 1; +const int MONSTER_SKILL_MEDIUM = 3; +const int MONSTER_SKILL_HARD = 5; +const int MONSTER_SKILL_INSANE = 7; +const int MONSTER_SKILL_NIGHTMARE = 10; + +const int MONSTERSKILL_NOTEASY = 256; // monster will not spawn on skill <= 1 +const int MONSTERSKILL_NOTMEDIUM = 512; // monster will not spawn on skill 2 +const int MONSTERSKILL_NOTHARD = 1024; // monster will not spawn on skill >= 3 + +// spawn flags +const int MONSTERFLAG_APPEAR = 2; // delay spawn until triggered +const int MONSTERFLAG_NORESPAWN = 4; +const int MONSTERFLAG_FLY_VERTICAL = 8; // fly/swim vertically +const int MONSTERFLAG_INFRONT = 32; // only check for enemies infront of us +const int MONSTERFLAG_MINIBOSS = 64; // monster spawns as mini-boss (also has a chance of naturally becoming one) +const int MONSTERFLAG_INVINCIBLE = 128; // monster doesn't take damage (may be used for map objects & temporary monsters) +const int MONSTERFLAG_SPAWNED = 16384; // flag for spawned monsters +const int MONSTERFLAG_RESPAWNED = 32768; // flag for re-spawned monsters + +// compatibility with old maps (soon to be removed) +.float monster_lifetime; +.int monster_skill; -.float wander_delay; -.float wander_distance; +// functions used elsewhere +void Monster_Remove(entity this); -.float monster_lifetime; +void monsters_setstatus(entity this); -.float spider_slowness; // special spider timer +bool Monster_Spawn(entity this, int mon_id); -void monster_remove(entity mon); // removes a monster +void monster_setupcolors(entity this); -.float(float attack_type) monster_attackfunc; -const float MONSTER_ATTACK_MELEE = 1; -const float MONSTER_ATTACK_RANGED = 2; +void Monster_Touch(); -.float monster_skill; -const float MONSTER_SKILL_EASY = 1; -const float MONSTER_SKILL_MEDIUM = 3; -const float MONSTER_SKILL_HARD = 5; -const float MONSTER_SKILL_INSANE = 7; -const float MONSTER_SKILL_NIGHTMARE = 10; +void Monster_Move_2D(entity this, float mspeed, float allow_jumpoff); -.float fish_wasdrowning; // used to reset a drowning fish's angles if it reaches water again +void Monster_Delay(entity this, int repeat_count, float defer_amnt, void(entity) func); -.float candrop; +float Monster_Attack_Melee(entity this, entity targ, float damg, vector anim, float er, float animtime, int deathtype, float dostop); -.float attack_range; +bool Monster_Attack_Leap(entity this, vector anm, void() touchfunc, vector vel, float animtime); -.float spawn_time; // stop monster from moving around right after spawning +entity Monster_FindTarget(entity this); -.string oldtarget2; -.float lastshielded; +void monster_makevectors(entity this, entity targ); -.vector oldangles; +void Monster_Sound(entity this, .string samplefield, float sound_delay, float delaytoo, float chan); -.float m_armor_blockpercent; +/** number of monsters spawned with mobspawn command */ +int totalspawned; // monster sounds -// copied from player sounds .float msound_delay; // temporary antilag system #define ALLMONSTERSOUNDS \ _MSOUND(death) \ @@ -55,7 +105,8 @@ const float MONSTER_SKILL_NIGHTMARE = 10; _MSOUND(melee) \ _MSOUND(pain) \ _MSOUND(spawn) \ - _MSOUND(idle) + _MSOUND(idle) \ + _MSOUND(attack) #define _MSOUND(m) .string monstersound_##m; ALLMONSTERSOUNDS @@ -63,26 +114,4 @@ ALLMONSTERSOUNDS float GetMonsterSoundSampleField_notFound; -const float MONSTERSKILL_NOTEASY = 256; // monster will not spawn on skill <= 1 -const float MONSTERSKILL_NOTMEDIUM = 512; // monster will not spawn on skill 2 -const float MONSTERSKILL_NOTHARD = 1024; // monster will not spawn on skill >= 3 - -// new flags -const float MONSTERFLAG_APPEAR = 2; // delay spawn until triggered -const float MONSTERFLAG_NORESPAWN = 4; -const float MONSTERFLAG_FLY_VERTICAL = 8; // fly/swim vertically -const float MONSTERFLAG_INFRONT = 32; // only check for enemies infront of us -const float MONSTERFLAG_MINIBOSS = 64; // monster spawns as mini-boss (also has a chance of naturally becoming one) -const float MONSTERFLAG_INVINCIBLE = 128; // monster doesn't take damage (may be used for map objects & temporary monsters) -const float MONSTERFLAG_SPAWNED = 16384; // flag for spawned monsters -const float MONSTERFLAG_RESPAWNED = 32768; // flag for re-spawned monsters - -.float monster_movestate; // used to tell what the monster is currently doing -const float MONSTER_MOVE_OWNER = 1; // monster will move to owner if in range, or stand still -const float MONSTER_MOVE_WANDER = 2; // monster will ignore owner & wander around -const float MONSTER_MOVE_SPAWNLOC = 3; // monster will move to its spawn location when not attacking -const float MONSTER_MOVE_NOMOVE = 4; // monster simply stands still -const float MONSTER_MOVE_ENEMY = 5; // used only as a movestate - -const float MONSTER_STATE_ATTACK_LEAP = 1; -const float MONSTER_STATE_ATTACK_MELEE = 2; +#endif