mirror of
https://github.com/UberGames/rpgxEF.git
synced 2025-02-15 16:41:16 +00:00
3 new lua-functions and updated definitions.
*entity.FindMMB(vector origin) that will loop trougt all MMB's and return the one that is matching the input with it's s.origin *qmath.irandom(int i, int j) and qmath.flrandom(float i, float j) that are returning a random number of their type within the intervall specified by i and j *started redesigning all the definitions. I'll get back to this once I'm back from work in 4 hrs or so. Signed-off-by: Harry Young <hendrik.gerritzen@googlemail.com>
This commit is contained in:
parent
be557e0052
commit
b9b61d2955
7 changed files with 1919 additions and 55 deletions
|
@ -246,19 +246,33 @@ void breakable_spawn_trigger(gentity_t *ent) {
|
|||
//RPG-X | GSIO01 | 09/05/2009 EOE
|
||||
|
||||
/*QUAKED func_breakable (0 .8 .5) ? x x x x INVINCIBLE x x x REPAIRABLE NOORIGIN
|
||||
INVINCIBLE - can only be broken by being used
|
||||
REPAIRABLE - con be repaired with hyperspanner
|
||||
|
||||
-----DESCRIPTION-----
|
||||
When destroyed, fires it's trigger and explodes
|
||||
When repaired just fires it's targets so things like forcefields get turned back on
|
||||
|
||||
"targetname" entities with matching target will fire it
|
||||
"paintarget" target to fire when hit (but not destroyed)
|
||||
"wait" how long minimum to wait between firing paintarget each time hit
|
||||
"model2" .md3 model to also draw
|
||||
"target" all entities with a matching targetname will be used when this is destoryed
|
||||
"health" default is 10
|
||||
-----SPAWNFLAGS-----
|
||||
1: DO NOT USE! This may come in conflict with shared functions from misc_model_breakable.
|
||||
2: DO NOT USE! This may come in conflict with shared functions from misc_model_breakable.
|
||||
4: DO NOT USE! This may come in conflict with shared functions from misc_model_breakable.
|
||||
8: DO NOT USE! This may come in conflict with shared functions from misc_model_breakable.
|
||||
16: INVINCIBLE - can only be broken by being used
|
||||
32: DO NOT USE! This may come in conflict with shared functions from misc_model_breakable.
|
||||
64: DO NOT USE! This may come in conflict with shared functions from misc_model_breakable.
|
||||
128: DO NOT USE! This may come in conflict with shared functions from misc_model_breakable.
|
||||
256: REPAIRABLE - can be repaired with hyperspanner, requires an origin brush
|
||||
512: NOORIGIN - used for retrofitting repairability on func_breakables with no origin brush, do not use for new maps
|
||||
|
||||
"team" - This cannot take damage from members of this team (2 = blue, 1 = red)
|
||||
-----KEYS-----
|
||||
"targetname" - entities with matching target will fire it
|
||||
"paintarget" - target to fire when hit (but not destroyed)
|
||||
"wait" - how long minimum to wait between firing paintarget each time hit
|
||||
"model2" - .md3 model to also draw
|
||||
"target" - all entities with a matching targetname will be used when this is destoryed
|
||||
"health" - default is 10
|
||||
|
||||
"luaDie" - Lua-Hook for when the breakable dies
|
||||
|
||||
"team" - This cannot take damage from members of this team (2 = blue, 1 = red) 2 will exclude players/clients in RPG-X
|
||||
|
||||
Damage: default is none
|
||||
"splashDamage" - damage to do (will make it explode on death
|
||||
|
@ -273,9 +287,34 @@ Damage: default is none
|
|||
5 - stone
|
||||
|
||||
Don't know if these work:
|
||||
"color" constantLight color
|
||||
"light" constantLight radius
|
||||
"color" - constantLight color
|
||||
"light" - constantLight radius
|
||||
|
||||
q3map2:
|
||||
"_clone" _clonename of entity to clone brushes from. Note: this entity still needs at least one brush which gets replaced.
|
||||
"_clonename" see _clone
|
||||
"_castShadows" OR "_cs" sets whether the entity casts shadows
|
||||
"_receiveShadows" OR "_rs" sets whether the entity receives shadows
|
||||
|
||||
-----LUA-----
|
||||
Retrofitting repairability using lua:
|
||||
Retrofitting repairability is possible, however it is not easy as we likely have to come by the fact taht we do not have an origin brush.
|
||||
To start here is the code with no origin brush present:
|
||||
|
||||
ent = entity.FindBModel(bmodel);
|
||||
ent:SetSpawnflags(ent:GetSpawnflags() + 768);
|
||||
--Do not use entity.CallSpawn(ent); after this point for this entity!
|
||||
mover.SetAngles2(ent, posX, posY, posZ);
|
||||
ent:SetN00bCount(radius);
|
||||
|
||||
The bmodel-number can be retrieved ingame as an admin/developer by pointing at the entity and using the /getentinfo command
|
||||
posX, Y andf Z are the origin (usually the center of brush) of the entity and need too be retrieved manually from within the radiant
|
||||
radius is a spherical distance around origin/angles2 that the hyperspanner will respond to. It should barely cover the entire facing side of the entity.
|
||||
|
||||
In the unlikely event that we do have an origin brush this is the code:
|
||||
|
||||
ent = entity.FindBModel(bmodel);
|
||||
ent:SetSpawnflags(ent:GetSpawnflags() + 256);
|
||||
*/
|
||||
/**
|
||||
* Spawnfunction for func_breakable entity.
|
||||
|
@ -317,25 +356,38 @@ void SP_func_breakable( gentity_t *self )
|
|||
level.numBrushEnts++;
|
||||
}
|
||||
|
||||
/*QUAKED misc_model_breakable (1 0 0) (-16 -16 -16) (16 16 16) SOLID AUTOANIMATE DEADSOLID NO_DMODEL INVINCIBLE x x x REPAIRABLE
|
||||
SOLID - Movement is blocked by it, if not set, can still be broken by explosions and shots if it has health
|
||||
AUTOANIMATE - Will cycle it's anim
|
||||
DEADSOLID - Stay solid even when destroyed (in case damage model is rather large).
|
||||
NO_DMODEL - Makes it NOT display a damage model when destroyed, even if one exists
|
||||
INVINCIBLE - Can only be broken by being used
|
||||
/*QUAKED misc_model_breakable (1 0 0) (-16 -16 -16) (16 16 16) SOLID AUTOANIMATE DEADSOLID NO_DMODEL INVINCIBLE X X X REPAIRABLE X
|
||||
-----DESCRIPTION-----
|
||||
Destroyable *.md3-model. If it dies it will display it's damge model if one exists and fire it's targets.
|
||||
If repaired by either target_repair (not yet implemented) or hyperspanner (not yet fully implemented) it will fire it's targets
|
||||
|
||||
"model" arbitrary .md3 file to display
|
||||
"health" how much health to have - default is zero (not breakable) If you don't set the SOLID flag, but give it health, it can be shot but will not block NPCs or players from moving
|
||||
"targetname" when used, dies and displays damagemodel, if any (if not, removes itself)
|
||||
"target" What to use when it dies
|
||||
"paintarget" target to fire when hit (but not destroyed)
|
||||
"wait" how long minimum to wait between firing paintarget each time hit
|
||||
-----SPAWNFLAGS-----
|
||||
1: SOLID - Movement is blocked by it, if not set, can still be broken by explosions and shots if it has health
|
||||
2: AUTOANIMATE - Will cycle it's anim
|
||||
4: DEADSOLID - Stay solid even when destroyed (in case damage model is rather large).
|
||||
8: NO_DMODEL - Makes it NOT display a damage model when destroyed, even if one exists. Needs to be set if none exist.
|
||||
16: INVINCIBLE - Can only be broken by being used
|
||||
32: X - DO NOT USE! This may come in conflict with shared functions from func_breakable.
|
||||
64: X - DO NOT USE! This may come in conflict with shared functions from func_breakable.
|
||||
128: X - DO NOT USE! This may come in conflict with shared functions from func_breakable.
|
||||
256: REPAIRABLE - can be repaired with hyperspanner
|
||||
512: X - DO NOT USE! This may come in conflict with shared functions from func_breakable.
|
||||
|
||||
-----KEYS-----
|
||||
"model" - path to the arbitrary .md3 file to display
|
||||
"health" - how much health to have - default is zero (not breakable) If you don't set the SOLID flag, but give it health, it can be shot but will not block NPCs or players from moving
|
||||
"targetname" - when used, dies and displays damagemodel, if any (if not, removes itself)
|
||||
"target" - What to use when it dies
|
||||
"paintarget" - target to fire when hit (but not destroyed)
|
||||
"wait" - how long minimum to wait between firing paintarget each time hit
|
||||
|
||||
"luaDie" - Lua-Hook for when the breakable dies
|
||||
|
||||
Damage: default is none
|
||||
"splashDamage" - damage to do (will make it explode on death)
|
||||
"splashRadius" - radius for above damage
|
||||
|
||||
"team" - This cannot take damage from members of this team (2 = blue, 1 = red)
|
||||
"team" - This cannot take damage from members of this team (2 = blue, 1 = red) 2 will exclude players/clients in RPG-X
|
||||
|
||||
"material" - sets the chunk type:
|
||||
0 - none (default)
|
||||
|
@ -345,11 +397,34 @@ Damage: default is none
|
|||
4 - wood
|
||||
5 - stone
|
||||
|
||||
FIXME/TODO:
|
||||
-----LUA-----
|
||||
Finding an MMB for post-spawn manipulation:
|
||||
For this purpose we have created a function that will return the first of these that has a matching s.origin.
|
||||
You can get the s.origin ingame as an admin/developer by pointing at the MMB ingame and using the /getorigin-command.
|
||||
This is how it should look:
|
||||
|
||||
vec = vector.Construct(s.origin[X], s.origin[Y], s.origin[Z]);
|
||||
ent = entity.FindMMB(vec);
|
||||
|
||||
Refitting repairablility using lua:
|
||||
This is a fairly simple addition, here's the code:
|
||||
|
||||
vec = vector.Construct(s.origin[X], s.origin[Y], s.origin[Z]);
|
||||
MMB = entity.FindMMB(vec);
|
||||
MMB:SetSpawnflags(MMB:
|
||||
GetSpawnflags() + 256);
|
||||
if MMB:GetHealth() == 0 then --we do require health to be present for repairability
|
||||
MMB:SetHealth (1);
|
||||
entity.CallSpawn(MMB);
|
||||
end
|
||||
*/
|
||||
/*
|
||||
FIXME/TODO on misc_model_breakable:
|
||||
set size better?
|
||||
multiple damage models?
|
||||
don't throw chunks on pain, or throw level 1 chunks only on pains?
|
||||
custom explosion effect/sound?
|
||||
custom dmodel using model2?
|
||||
*/
|
||||
/**
|
||||
* Spawnfunction for misc_model_breakable entity.
|
||||
|
@ -594,13 +669,20 @@ void ammo_station_finish_spawning ( gentity_t *self )
|
|||
}
|
||||
//------------------------------------------------------------
|
||||
/*QUAKED misc_ammo_station (1 0 0) (-16 -16 -16) (16 16 16)
|
||||
-----DESCRIPTION-----
|
||||
Grants ammo to client until depleted.
|
||||
This useless in RPG-X unless you'd like to spawn a DN-ammo-console.
|
||||
|
||||
-----Spawnflags-----
|
||||
none
|
||||
|
||||
-----KEYS-----
|
||||
"health" - how much health the model has - default 60 (zero makes non-breakable)
|
||||
"target" - what to use when it dies
|
||||
"paintarget" - target to fire when hit (but not destroyed)
|
||||
"count" - the amount of health given when used (default 1000)
|
||||
|
||||
"team" - This cannot take damage from members of this team and only members of this team can use it (2 = blue, 1 = red)
|
||||
"team" - This cannot take damage from members of this team and only members of this team can use it (2 = blue, 1 = red) 2 will exclude players/clients in RPG-X
|
||||
*/
|
||||
//------------------------------------------------------------
|
||||
/**
|
||||
|
@ -652,10 +734,18 @@ void SP_misc_ammo_station( gentity_t *ent )
|
|||
|
||||
//RPG-X | GSIO01 | 09/05/2009 SOE
|
||||
/*QUAKED target_repair (1 0 0) (-8 -8 -8) (8 8 8)
|
||||
Repairs a func_breakable.
|
||||
-----DESCRIPTION-----
|
||||
Repairs a func_breakable..
|
||||
|
||||
"target" breakable to repair (targetname2)
|
||||
-----SPAWNFLAGS-----
|
||||
none
|
||||
|
||||
-----KEYS-----
|
||||
"target" breakable to repair (targetname or targetname2)
|
||||
*/
|
||||
|
||||
//We need to think about how to implement MMB's into this. Also maybe write a target_repair_multiple that skims both classes via while-loop --Harry
|
||||
|
||||
/**
|
||||
* Use function of target_repair entity.
|
||||
* Repairs it's target entity (stored in ent->lastEnemy)
|
||||
|
|
|
@ -207,6 +207,7 @@ void trigger_always_think( gentity_t *ent ) {
|
|||
|
||||
/*QUAKED trigger_always (.5 .5 .5) (-8 -8 -8) (8 8 8)
|
||||
This trigger will always fire. It is activated by the world.
|
||||
Actually this is going to fire once 0.3 secs after spawn...
|
||||
*/
|
||||
/**
|
||||
* \brief Spawn function of trigger_multiple.
|
||||
|
|
|
@ -691,7 +691,8 @@ Will aim and shoot at enemies
|
|||
targetname - Toggles it on/off
|
||||
target - What to use when destroyed
|
||||
|
||||
"team" - This cannot take damage from members of this team and will not target members of this team (2 = blue, 1 = red)
|
||||
"team" - This cannot take damage from members of this team and will not target members of this team (2 = blue, 1 = red) 2 will exclude players in RPG-X
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -10,12 +10,15 @@ extern void InitTrigger(gentity_t *self);
|
|||
|
||||
/*
|
||||
QUAKED ui_transporter (.5 .5 .5) ? DISABLED
|
||||
-----DESCRIPTION-----
|
||||
Opens the transporter UI.
|
||||
|
||||
DISABLED Entity is disabled
|
||||
-----SPAWNFLAGS-----
|
||||
1: DISABLED - Entity is disabled
|
||||
|
||||
"swapname" enables/disables entity(NO_ACTIVATOR/SELF flag must be checked for any entity using this)
|
||||
"target" trigger_transporter to use with this ui_transporter
|
||||
-----KEYS-----
|
||||
"swapname" - enables/disables entity(NO_ACTIVATOR/SELF flag must be checked for any entity using this)
|
||||
"target" - trigger_transporter to use with this ui_transporter
|
||||
*/
|
||||
/**
|
||||
* \brief Think function for ui_transporter entity.
|
||||
|
@ -109,12 +112,15 @@ void SP_ui_transporter(gentity_t *ent) {
|
|||
|
||||
/*
|
||||
QUAKED ui_holodeck (.5 .5 .5) ? DISABLED
|
||||
Opens the holodeck UI.
|
||||
-----Description-----
|
||||
Will open the holodeck UI once this is implemented. For now this will not spawn.
|
||||
|
||||
DISABLED Entity is disabled
|
||||
-----SPAWNFLAGS-----
|
||||
1: DISABLED Entity is disabled
|
||||
|
||||
"swapname" enables/disables entity(NO_ACTIVATOR/SELF flag must be checked for any entity using this)
|
||||
"target" trigger_holodeck to use with this ui_holodeck
|
||||
-----KEYS-----
|
||||
"swapname" - enables/disables entity(NO_ACTIVATOR/SELF flag must be checked for any entity using this)
|
||||
"target" - trigger_holodeck to use with this ui_holodeck
|
||||
*/
|
||||
void ui_holodeck_think(gentity_t *ent) {
|
||||
if(!ent->activator || ent->sound1to2 >= 10000) { /* player disconnect or was idle more than 10 seconds */
|
||||
|
|
|
@ -176,27 +176,71 @@ void func_usable_die(gentity_t *self, gentity_t *inflictor, gentity_t *attacker,
|
|||
}
|
||||
|
||||
/*QUAKED func_usable (0 .5 .8) ? STARTOFF AUTOANIM x ALWAYS_ON NOBLOCKCHECK x x x ADMIN_ONLY NO_ACTIVATOR NO_AREAPORTAL DEACTIVATED
|
||||
START_OFF - the wall will not be there
|
||||
AUTOANIM - If useing an md3, it will animate
|
||||
ALWAYS_ON - Doesn't toggle on and off when used, just fires target
|
||||
NOBLOCKCHECK - Will NOT turn on while something is inside it unless this is checked
|
||||
ADMIN_ONLY - can only be used by admins
|
||||
NO_ACTIVATOR - use the ent itself instead the player as activator
|
||||
NO_AREAPORTAL - don't affect areaportals
|
||||
DEACTIVATED - start deactivated
|
||||
-----DESCRIPTION-----
|
||||
A bmodel that can be used directly by the player's "activate" button.
|
||||
Can be used for visual FX (like alert lights) or as a button.
|
||||
|
||||
A bmodel that can be used directly by the player's "activate" button
|
||||
-----SPAWNFLAGS-----
|
||||
1: START_OFF - the wall will not be there
|
||||
2: AUTOANIM - If useing an md3, it will animate
|
||||
4: X -Not in Use. Holds ANIM_ONCE for models
|
||||
8: ALWAYS_ON - Doesn't toggle on and off when used, just fires target
|
||||
16: NOBLOCKCHECK - Will NOT turn on while something is inside it unless this is checked
|
||||
32: X - Not in Use.
|
||||
64: X - Not in Use.
|
||||
128: X - Not in Use.
|
||||
256: ADMIN_ONLY - can only be used by admins
|
||||
512: NO_ACTIVATOR - use the ent itself instead the player as activator
|
||||
1024: NO_AREAPORTAL - don't affect areaportals
|
||||
2048: DEACTIVATED - start deactivated
|
||||
|
||||
"targetname" When used, will toggle on and off
|
||||
"target" Will fire this target every time it is toggled OFF
|
||||
"model2" .md3 model to also draw
|
||||
"color" constantLight color
|
||||
"light" constantLight radius
|
||||
"wait" amount of time before the object is usable again (only valid with ALWAYS_ON flag)
|
||||
"health" if it has health, it will be used whenever shot at/killed - if you want it to only be used once this way, set health to 1
|
||||
"messageNum" the number relating to the message string that will display when the player scans this usable with a tricorder
|
||||
-----KEYS-----
|
||||
"targetname" - When used, will toggle on and off
|
||||
"target" - Will fire this target every time it is toggled OFF
|
||||
"model2" - .md3 model to also draw
|
||||
"color" - constantLight color
|
||||
"light" - constantLight radius
|
||||
"wait" - amount of time before the object is usable again (only valid with ALWAYS_ON flag)
|
||||
"health" - if it has health, it will be used whenever shot at/killed - if you want it to only be used once this way, set health to 1
|
||||
|
||||
"team" - This can only be used by this team (2 = blue, 1 = red)
|
||||
"luaUse" - lua-function to call from scripts/lua/<mapname>/<mapname>.lua when this entity is used
|
||||
|
||||
"message" - message string that will display when the player scans this usable with a tricorder
|
||||
"messageNum" - the number relating to the message string in the /maps/<mapname>.usables-file that will display when the player scans this usable with a tricorder
|
||||
NOTE: only use one of the above ways on a map at a time
|
||||
|
||||
"team" - This can only be used by this team (2 = blue, 1 = red) 2 will exclude players in RPG-X
|
||||
|
||||
q3map2:
|
||||
"_clone" _clonename of entity to clone brushes from. Note: this entity still needs at least one brush which gets replaced.
|
||||
"_clonename" see _clone
|
||||
"_castShadows" OR "_cs" sets whether the entity casts shadows
|
||||
"_receiveShadows" OR "_rs" sets whether the entity receives shadows
|
||||
|
||||
-----LUA-----
|
||||
Sounds for consoles:
|
||||
One of the advantages with luaUse-functions is that you can play sounds on the usable you're using this comes in very handy if you'd like to for example play a sound on the turbolift-usable:
|
||||
|
||||
function turbocontrol(ent, other, activator) --set luaUse to turbocontrol for this to trigger
|
||||
if ent.GetCount(entity.Find("info_turbolift")) == 1 then --for a trubolift in particular you need an external information provider as lua can't deal with bit-flags. In this case turbolift would be offline.
|
||||
sound.PlaySound(ent, "sound/movers/switches/voyneg.mp3", 0);
|
||||
game.MessagePrint(ent.GetNumber(activator), "=C= Unable to comply: The Turbolift is offline.");
|
||||
else
|
||||
sound.PlaySound(ent, "sound/voice/computer/tour/trblftmenu.mp3", 0);
|
||||
end
|
||||
end
|
||||
|
||||
Also if you have a (morer or less) generic console that you want to fire generic console sounds off of you can extend this script for any number of sounds of which one will be picked randomly:
|
||||
|
||||
function consolesounds(ent, other, activator)
|
||||
i = qmath.irandom(1, <insert number of sounds here>);
|
||||
if i == 1 then
|
||||
sound.PlaySound(ent, <inseet soundpath here>, 0);
|
||||
end
|
||||
if i == n then
|
||||
sound.PlaySound(ent, <inseet soundpath here>, 0);
|
||||
end
|
||||
end
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -142,6 +142,34 @@ static int Entity_Find(lua_State * L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
// entity.FindMMB(vector origin)
|
||||
// Returns the misc_model_breakable entity that has a matching MMB->s.origin.
|
||||
// Requires vector as input.
|
||||
// You can get the s.origin ingame as an admin/developer by pointing at the MMB ingame and using the /getorigin-command.
|
||||
static int Entity_FindMMB(lua_State * L)
|
||||
{
|
||||
gentity_t *t = NULL, *MMB = NULL;
|
||||
vec_t *vec, *origin;
|
||||
|
||||
vec = Lua_GetVector(L, 2);
|
||||
|
||||
while((MMB = G_Find(MMB, FOFS(classname), "misc_model_breakable")) != NULL){
|
||||
origin = MMB->s.origin;
|
||||
if(vec[0] == origin[0] && vec[1] == origin[1] && vec[2] == origin[2]){
|
||||
t = MMB;
|
||||
break;
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(!t)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
Lua_PushEntity(L, t);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// entity.Use(entity ent)
|
||||
// Uses ent.
|
||||
static int Entity_Use(lua_State * L)
|
||||
|
@ -2821,6 +2849,7 @@ static int Entity_SetTeammaster(lua_State *L) {
|
|||
static const luaL_Reg Entity_ctor[] = {
|
||||
{"Spawn", Entity_Spawn},
|
||||
{"Find", Entity_Find},
|
||||
{"FindMMB", Entity_FindMMB},
|
||||
{"FindNumber", Entity_FindNumber},
|
||||
{"FindBModel", Entity_FindBModel},
|
||||
{"GetTarget", Entity_GetTarget},
|
||||
|
|
1693
rpg-x_entities.def
Normal file
1693
rpg-x_entities.def
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue