Skip to content

Commit

Permalink
make teleports work for spectators
Browse files Browse the repository at this point in the history
closes #51
  • Loading branch information
sauerbraten committed Mar 17, 2022
1 parent 382cf92 commit 9104dea
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ apply-patches:
$(PATCH) < patches/nextfollowteam.patch
$(PATCH) < patches/proxy_setip.patch
$(PATCH) < patches/server_demo_name.patch
$(PATCH) < patches/spec_teleports.patch
unix2dos src/vcpp/sauerbraten.nsi
unix2dos src/vcpp/sauerbraten.vcxproj
cd src && make depend
Expand Down
19 changes: 19 additions & 0 deletions patches/spec_teleports.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git src/fpsgame/entities.cpp src/fpsgame/entities.cpp
index a492ca5..9ae842d 100644
--- src/fpsgame/entities.cpp
+++ src/fpsgame/entities.cpp
@@ -335,8 +335,13 @@ namespace entities

void checkitems(fpsent *d)
{
- if(d->state!=CS_ALIVE) return;
vec o = d->feetpos();
+ if(d->state==CS_SPECTATOR) loopv(ents)
+ {
+ extentity &e = *ents[i];
+ if(e.type==TELEPORT && e.o.dist(o)<16) trypickup(i, d);
+ }
+ if(d->state!=CS_ALIVE) return;
loopv(ents)
{
extentity &e = *ents[i];
7 changes: 6 additions & 1 deletion src/fpsgame/entities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,13 @@ namespace entities

void checkitems(fpsent *d)
{
if(d->state!=CS_ALIVE) return;
vec o = d->feetpos();
if(d->state==CS_SPECTATOR) loopv(ents)
{
extentity &e = *ents[i];
if(e.type==TELEPORT && e.o.dist(o)<16) trypickup(i, d);
}
if(d->state!=CS_ALIVE) return;
loopv(ents)
{
extentity &e = *ents[i];
Expand Down

0 comments on commit 9104dea

Please sign in to comment.