]> de.git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Make consumable items show when and where they should, and prepare them for actual...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 19 Nov 2011 11:40:15 +0000 (13:40 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 19 Nov 2011 11:40:15 +0000 (13:40 +0200)
data/defaultVT.cfg
data/qcsrc/server/constants.qh
data/qcsrc/server/t_items.qc
data/qcsrc/server/vore.qc

index b23a2d44be12575f08535d94c83669dcf7e42bfa..87b803285167071db6a9df4f4a966a83de004c9f 100644 (file)
@@ -1627,6 +1627,7 @@ set g_vore_regurgitatecolor_color_digest "0.3 0.15 0" "the color players will ha
 set g_vore_regurgitatecolor_fade 0.01 "how quickly the regurgitation color washes off players once they leave the stomach, does not apply to dead bodies"\r
 set g_vore_regurgitatecolor_particles 0.75 "players who are dirty from regurgitation generate particles this often, based on the amount of goo they have on them"\r
 set g_vore_neighborprey_distance 4 "Distance by which prey inside the same stomach are positioned away from each other. 0 disables seeing neighboring prey"\r
+set g_vore_neighborprey_distance_item 4 "Distance by which items inside the same stomach are positioned away from each other. 0 disables seeing neighboring items"\r
 set g_vore_swallowmodel_range 100 "Distance by which the swallow model oscillates based on swallow progress"\r
 \r
 seta cl_healthsize_fov 0.2 "offset field of view by this amount based on size, to further induce the effect of being large or small"\r
index 69aae0c34b6a1b8adb6c63122b10e6a2f89e8990..9481d46a23a2b9b04356f35a541cc377f68fdd87 100644 (file)
@@ -132,6 +132,8 @@ vector      PL_CROUCH_MIN                           = '-16 -16 -24';
 vector PL_CROUCH_MAX                           = '16 16 25';\r
 vector PL_PREY_VIEW_OFS                        = '0 0 25';\r
 \r
+vector CONSUMABLE_VIEW_OFS                     = '0 0 15';\r
+\r
 // Sajt - added these, just as constants. Not sure how you want them actually put in the game, but I just\r
 // did this so at least they worked\r
 //float        GAME_FULLBRIGHT_PLAYERS                 = 64; /// makes the players model fullbright\r
index cf8d560483159101b8ba143d5d2be6bcc258bb74..80116ce828e452a4d1f38c3095f882c499d06daf 100644 (file)
@@ -219,18 +219,37 @@ void Item_ScheduleInitialRespawn(entity e)
        Item_ScheduleRespawnIn(e, game_starttime - time + ITEM_RESPAWNTIME_INITIAL(e));\r
 }\r
 \r
+float Item_Consumable_Customizeentityforclient()\r
+{\r
+       if(cvar("g_vore_neighborprey_distance_item") && self.predator == other.predator && !(other.cvar_chase_active || other.classname == "observer"))\r
+       {\r
+               self.alpha = default_player_alpha; // allow seeing neighboring items\r
+               self.effects |= EF_NODEPTHTEST; // don't hide behind the stomach's own EF_NODEPTHTEST\r
+       }\r
+       else\r
+               self.alpha = -1; // hide item\r
+       return TRUE;\r
+}\r
+\r
 void Item_Consumable_Spawn(entity e, entity pl)\r
 {\r
        entity item;\r
        item = spawn();\r
        item.owner = e;\r
        item.classname = "consumable";\r
-       setmodel(item, e.model);\r
        item.movetype = MOVETYPE_FOLLOW;\r
        item.solid = SOLID_NOT;\r
+       setmodel(item, e.model);\r
+       item.health = e.health;\r
+       item.max_health = e.max_health;\r
 \r
        item.predator = pl;\r
        item.aiment = pl;\r
+       item.view_ofs_x = CONSUMABLE_VIEW_OFS_x + crandom() * cvar("g_vore_neighborprey_distance_item");\r
+       item.view_ofs_y = CONSUMABLE_VIEW_OFS_y + crandom() * cvar("g_vore_neighborprey_distance_item");\r
+       item.view_ofs_z = CONSUMABLE_VIEW_OFS_z;\r
+\r
+       item.customizeentityforclient = Item_Consumable_Customizeentityforclient;\r
 }\r
 \r
 float Item_GiveTo(entity item, entity player)\r
index 1688588ef5afbcf98f06f46372e681ca887f6a40..8a2ddf5e5096fbb9d0f91a63055edd2a911b438e 100644 (file)
@@ -121,7 +121,6 @@ void Vore_SetPreyPositions(entity pred)
        // pred is the predator and head is the prey\r
 \r
        local entity head;\r
-       local vector origin_apply;\r
 \r
        // In order to allow prey to see each other in the stomach, we must position each occupant differently,\r
        // else all players overlap in the center. To do this, we use a random origin on all players in the same stomach.\r
@@ -129,12 +128,10 @@ void Vore_SetPreyPositions(entity pred)
        {\r
                if(head.predator == pred)\r
                {\r
-                       origin_apply_x = PL_PREY_VIEW_OFS_x + crandom() * cvar("g_vore_neighborprey_distance");\r
-                       origin_apply_y = PL_PREY_VIEW_OFS_y + crandom() * cvar("g_vore_neighborprey_distance");\r
-                       origin_apply_z = PL_PREY_VIEW_OFS_z;\r
-\r
                        // since prey have their predators set as an aiment, view_ofs will specify the real origin of prey, not just the view offset\r
-                       head.view_ofs = origin_apply;\r
+                       head.view_ofs_x = PL_PREY_VIEW_OFS_x + crandom() * cvar("g_vore_neighborprey_distance");\r
+                       head.view_ofs_y = PL_PREY_VIEW_OFS_y + crandom() * cvar("g_vore_neighborprey_distance");\r
+                       head.view_ofs_z = PL_PREY_VIEW_OFS_z;\r
                }\r
        }\r
 }\r