Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map's apply_script version never gets called #781

Closed
dany-on-demand opened this issue Feb 28, 2024 · 1 comment
Closed

Map's apply_script version never gets called #781

dany-on-demand opened this issue Feb 28, 2024 · 1 comment
Assignees
Labels
wontfix The maintainers deem this issue as not worthy of fixing for some reason

Comments

@dany-on-demand
Copy link
Contributor

dany-on-demand commented Feb 28, 2024

def apply_script(self, protocol, connection, config):

Unlikely this is a regression? Guessing it was just never implemented fully

protocol_class, connection_class = script.apply_script(

The only place where apply_script gets called
It itself gets only called in server.py run() and only on files game_modes and scripts/ folder
I'm pretty sure the fix is to simply to call apply_script in the same manner as in run.py whenever the map changes/loads

Repro (not sure if the func is correct since I never got it to run) Test.txt:

name = 'Test'
version = '1.0'
author = 'Dany0'
description = 'Chungus.'

print("inside script for Test")

def apply_script(protocol, connection, config):
    print("Applying script for Test")
    class TestConnect(connection):
         def on_spawn(self, pos):
            print("entered on_spawn")
            return connection.on_spawn(self, pos)
    return protocol, TestConnect

stdout:

2024-02-29T00:02:27+0100 [stdout#info] inside script for Test
2024-02-29T00:02:27+0100 [piqueserver.map#info] Loading map 'Test'...

... nothing after

Expected:

inside script for Test
Applying script for Test
entered on_spawn (when player spawns)

@utf-4096 utf-4096 self-assigned this May 15, 2024
@utf-4096 utf-4096 added the discussion This issue is used only for discussion of a certain topic so the community can be heard label May 15, 2024
@utf-4096
Copy link
Member

You're right, it seems like this was a planned feature that was never finished since we never actually call <map instance>.apply_script(...).
IMO, map config files should have as little scripting as possible. If you need anything more complex than setting the player / tent / intel spawn positions, you should make a script or gamemode instead.

I think our future goal is to have a safe, non-scripted but extensible map format, so adding such a feature right now would not make much sense.

Unless there's a use case I can't think of right now, I'm probably gonna remove this apply_script() code entirely to prevent confusion.

@dany-on-demand dany-on-demand closed this as not planned Won't fix, can't repro, duplicate, stale May 15, 2024
@utf-4096 utf-4096 added wontfix The maintainers deem this issue as not worthy of fixing for some reason and removed discussion This issue is used only for discussion of a certain topic so the community can be heard labels May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix The maintainers deem this issue as not worthy of fixing for some reason
Projects
None yet
Development

No branches or pull requests

2 participants