Merge branch 'master' into more-687

This commit is contained in:
Ted Nyman
2013-12-06 20:32:22 -08:00
19 changed files with 2020 additions and 67 deletions

View File

@@ -1,2 +1,7 @@
source 'https://rubygems.org'
gemspec
if RUBY_VERSION < "1.9.3"
# escape_utils 1.0.0 requires 1.9.3 and above
gem "escape_utils", "0.3.2"
end

View File

@@ -31,9 +31,10 @@ We typically run on a pre-release version of Pygments, [pygments.rb](https://git
### Stats
The Language Graph you see on every repository is built by aggregating the languages of all repo's blobs. The top language in the graph determines the project's primary language. Collectively, these stats make up the [Top Languages](https://github.com/languages) page.
The Language Graph you see on every repository is built by aggregating the languages of each file in that repository.
The top language in the graph determines the project's primary language. Collectively, these stats make up the [Top Languages](https://github.com/languages) page.
The repository stats API can be used on a directory:
The repository stats API, accessed through `#languages`, can be used on a directory:
```ruby
project = Linguist::Repository.from_directory(".")
@@ -41,7 +42,7 @@ project.language.name #=> "Ruby"
project.languages #=> { "Ruby" => 0.98, "Shell" => 0.02 }
```
These stats are also printed out by the binary. Try running `linguist` on itself:
These stats are also printed out by the `linguist` binary. Try running `linguist` on itself:
$ bundle exec linguist lib/
100% Ruby
@@ -82,18 +83,18 @@ To run the tests:
## Contributing
The majority of patches won't need to touch any Ruby code at all. The [master language list](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml) is just a configuration file.
The majority of contributions won't need to touch any Ruby code at all. The [master language list](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml) is just a YAML configuration file.
We try to only add languages once they have some usage on GitHub, so please note in-the-wild usage examples in your pull request.
Almost all bug fixes or new language additions should come with some additional code samples. Just drop them under [`samples/`](https://github.com/github/linguist/tree/master/samples) in the correct subdirectory and our test suite will automatically test them. In most cases you shouldn't need to add any new assertions.
To update the samples.json after adding new files to [`samples/`](https://github.com/github/linguist/tree/master/samples):
To update the `samples.json` after adding new files to [`samples/`](https://github.com/github/linguist/tree/master/samples):
bundle exec rake samples
### Testing
Sometimes getting the tests running can be too much work, especially if you don't have much Ruby experience. It's okay, be lazy and let our build bot [Travis](http://travis-ci.org/#!/github/linguist) run the tests for you. Just open a pull request and the bot will start cranking away.
Sometimes getting the tests running can be too much work, especially if you don't have much Ruby experience. It's okay: be lazy and let our build bot [Travis](http://travis-ci.org/#!/github/linguist) run the tests for you. Just open a pull request and the bot will start cranking away.
Here's our current build status, which is hopefully green: [![Build Status](https://secure.travis-ci.org/github/linguist.png?branch=master)](http://travis-ci.org/github/linguist)

View File

@@ -1,5 +1,7 @@
require 'rake/clean'
require 'rake/testtask'
require 'yaml'
require 'json'
task :default => :test
@@ -13,6 +15,13 @@ task :samples do
File.open('lib/linguist/samples.json', 'w') { |io| io.write json }
end
task :build_gem do
languages = YAML.load_file("lib/linguist/languages.yml")
File.write("lib/linguist/languages.json", JSON.dump(languages))
`gem build github-linguist.gemspec`
File.delete("lib/linguist/languages.json")
end
namespace :classifier do
LIMIT = 1_000

View File

@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = 'github-linguist'
s.version = '2.9.8'
s.version = '2.10.0'
s.summary = "GitHub Language detection"
s.authors = "GitHub"
@@ -10,11 +10,12 @@ Gem::Specification.new do |s|
s.executables << 'linguist'
s.add_dependency 'charlock_holmes', '~> 0.6.6'
s.add_dependency 'escape_utils', '~> 0.3.1'
s.add_dependency 'escape_utils', '>= 0.3.1'
s.add_dependency 'mime-types', '~> 1.19'
s.add_dependency 'pygments.rb', '~> 0.5.2'
s.add_development_dependency 'mocha'
s.add_dependency 'pygments.rb', '~> 0.5.4'
s.add_development_dependency 'json'
s.add_development_dependency 'mocha'
s.add_development_dependency 'rake'
s.add_development_dependency 'yajl-ruby'
end

View File

@@ -15,8 +15,8 @@ module Linguist
#
# Returns nothing.
#
# Set LINGUIST_DEBUG=1 or =2 to see probabilities per-token,
# per-language. See also dump_all_tokens, below.
# Set LINGUIST_DEBUG=1 or =2 to see probabilities per-token or
# per-language. See also #dump_all_tokens, below.
def self.train!(db, language, data)
tokens = Tokenizer.tokenize(data)
@@ -151,10 +151,10 @@ module Linguist
printf "%#{maxlen}s", ""
puts " #" + languages.map { |lang| sprintf("%10s", lang) }.join
tokmap = Hash.new(0)
tokens.each { |tok| tokmap[tok] += 1 }
token_map = Hash.new(0)
tokens.each { |tok| token_map[tok] += 1 }
tokmap.sort.each { |tok, count|
token_map.sort.each { |tok, count|
arr = languages.map { |lang| [lang, token_probability(tok, lang)] }
min = arr.map { |a,b| b }.min
minlog = Math.log(min)

View File

@@ -75,14 +75,16 @@ module Linguist
# Internal: Is the blob minified files?
#
# Consider a file minified if it contains more than 5% spaces.
# Consider a file minified if the average line length is
# greater then 110c.
#
# Currently, only JS and CSS files are detected by this method.
#
# Returns true or false.
def minified_files?
return unless ['.js', '.css'].include? extname
if data && data.length > 200
(data.each_char.count{ |c| c <= ' ' } / data.length.to_f) < 0.05
if lines.any?
(lines.inject(0) { |n, l| n += l.length } / lines.length) > 110
else
false
end
@@ -191,8 +193,8 @@ module Linguist
return false unless extname == '.h'
return false unless lines.count > 2
return lines[0].include?("/* DO NOT EDIT THIS FILE - it is machine generated */")
return lines[1].include?("#include <jni.h>")
return lines[0].include?("/* DO NOT EDIT THIS FILE - it is machine generated */") &&
lines[1].include?("#include <jni.h>")
end
# node_modules/ can contain large amounts of files, in general not meant

View File

@@ -1,6 +1,10 @@
require 'escape_utils'
require 'pygments'
require 'yaml'
begin
require 'json'
rescue LoadError
end
require 'linguist/classifier'
require 'linguist/samples'
@@ -487,7 +491,16 @@ module Linguist
filenames = Samples::DATA['filenames']
popular = YAML.load_file(File.expand_path("../popular.yml", __FILE__))
YAML.load_file(File.expand_path("../languages.yml", __FILE__)).each do |name, options|
languages_yml = File.expand_path("../languages.yml", __FILE__)
languages_json = File.expand_path("../languages.json", __FILE__)
if File.exist?(languages_json) && defined?(JSON)
languages = JSON.load(File.read(languages_json))
else
languages = YAML.load_file(languages_yml)
end
languages.each do |name, options|
options['extensions'] ||= []
options['interpreters'] ||= []
options['filenames'] ||= []

View File

@@ -29,13 +29,13 @@ ABAP:
type: programming
lexer: ABAP
primary_extension: .abap
ANTLR:
type: programming
color: "#9DC3FF"
lexer: ANTLR
primary_extension: .g4
ASP:
type: programming
color: "#6a40fd"
@@ -71,6 +71,7 @@ Ada:
Agda:
type: programming
color: "#467C91"
primary_extension: .agda
ApacheConf:
@@ -123,6 +124,15 @@ AutoHotkey:
- ahk
primary_extension: .ahk
AutoIt:
type: programming
color: "#36699B"
aliases:
- au3
- AutoIt3
- AutoItScript
primary_extension: .au3
Awk:
type: programming
lexer: Awk
@@ -178,6 +188,11 @@ Brainfuck:
extensions:
- .bf
Brightscript:
type: programming
lexer: Text only
primary_extension: .brs
Bro:
type: programming
primary_extension: .bro
@@ -378,11 +393,11 @@ D-ObjDump:
type: data
lexer: d-objdump
primary_extension: .d-objdump
DM:
type: programming
color: "#075ff1"
lexer: Text only
lexer: C++
primary_extension: .dm
aliases:
- byond
@@ -404,6 +419,7 @@ Darcs Patch:
Dart:
type: programming
color: "#98BAD6"
primary_extension: .dart
DCPU-16 ASM:
@@ -414,7 +430,7 @@ DCPU-16 ASM:
- .dasm
aliases:
- dasm16
Diff:
primary_extension: .diff
@@ -463,7 +479,7 @@ Emacs Lisp:
- elisp
- emacs
primary_extension: .el
filenames:
filenames:
- .emacs
extensions:
- .emacs
@@ -749,6 +765,8 @@ JSON:
- .sublime_session
- .sublime-settings
- .sublime-workspace
filenames:
- composer.lock
Jade:
group: HTML
@@ -946,15 +964,17 @@ Matlab:
Max:
type: programming
color: "#ce279c"
lexer: Text only
lexer: JSON
aliases:
- max/msp
- maxmsp
search_term: max/msp
primary_extension: .mxt
primary_extension: .maxpat
extensions:
- .maxhelp
- .maxpat
- .maxproj
- .mxt
- .pat
MiniD: # Legacy
searchable: false
@@ -995,6 +1015,12 @@ Nemerle:
color: "#0d3c6e"
primary_extension: .n
NetLogo:
type: programming
lexer: Common Lisp
color: "#ff2b2b"
primary_extension: .nlogo
Nginx:
type: markup
lexer: Nginx configuration file
@@ -1488,6 +1514,7 @@ Tcsh:
TeX:
type: markup
color: "#3D6117"
ace_mode: latex
aliases:
- latex
@@ -1544,11 +1571,25 @@ Unified Parallel C:
color: "#755223"
primary_extension: .upc
UnrealScript:
type: programming
color: "#a54c4d"
lexer: Java
primary_extension: .uc
VHDL:
type: programming
lexer: vhdl
color: "#543978"
primary_extension: .vhdl
extensions:
- .vhd
- .vhf
- .vhi
- .vho
- .vhs
- .vht
- .vhw
Vala:
type: programming
@@ -1620,6 +1661,7 @@ XML:
- .grxml
- .jelly
- .kml
- .launch
- .mxml
- .plist
- .pluginspec
@@ -1629,6 +1671,7 @@ XML:
- .rdf
- .rss
- .scxml
- .srdf
- .svg
- .tmCommand
- .tmLanguage
@@ -1637,12 +1680,14 @@ XML:
- .tmTheme
- .tml
- .ui
- .urdf
- .vxml
- .wsdl
- .wxi
- .wxl
- .wxs
- .x3d
- .xacro
- .xaml
- .xlf
- .xliff
@@ -1653,6 +1698,7 @@ XML:
filenames:
- .classpath
- .project
- phpunit.xml.dist
XProc:
type: programming
@@ -1694,6 +1740,7 @@ YAML:
primary_extension: .yml
extensions:
- .reek
- .rviz
- .yaml
eC:

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,8 @@
require 'yaml'
begin
require 'json'
rescue LoadError
require 'yaml'
end
require 'linguist/md5'
require 'linguist/classifier'
@@ -14,7 +18,8 @@ module Linguist
# Hash of serialized samples object
if File.exist?(PATH)
DATA = YAML.load_file(PATH)
serializer = defined?(JSON) ? JSON : YAML
DATA = serializer.load(File.read(PATH))
end
# Public: Iterate over each sample.

View File

@@ -139,7 +139,7 @@
# LICENSE, README, git config files
- ^COPYING$
- ^LICENSE$
- LICENSE$
- gitattributes$
- gitignore$
- gitmodules$

View File

@@ -0,0 +1,305 @@
' *********************************************************
' ** Simple Grid Screen Demonstration App
' ** Jun 2010
' ** Copyright (c) 2010 Roku Inc. All Rights Reserved.
' *********************************************************
'************************************************************
'** Application startup
'************************************************************
Sub Main()
'initialize theme attributes like titles, logos and overhang color
initTheme()
gridstyle = "Flat-Movie"
'set to go, time to get started
while gridstyle <> ""
print "starting grid style= ";gridstyle
screen=preShowGridScreen(gridstyle)
gridstyle = showGridScreen(screen, gridstyle)
end while
End Sub
'*************************************************************
'** Set the configurable theme attributes for the application
'**
'** Configure the custom overhang and Logo attributes
'** These attributes affect the branding of the application
'** and are artwork, colors and offsets specific to the app
'*************************************************************
Sub initTheme()
app = CreateObject("roAppManager")
app.SetTheme(CreateDefaultTheme())
End Sub
'******************************************************
'** @return The default application theme.
'** Screens can make slight adjustments to the default
'** theme by getting it from here and then overriding
'** individual theme attributes.
'******************************************************
Function CreateDefaultTheme() as Object
theme = CreateObject("roAssociativeArray")
theme.ThemeType = "generic-dark"
' All these are greyscales
theme.GridScreenBackgroundColor = "#363636"
theme.GridScreenMessageColor = "#808080"
theme.GridScreenRetrievingColor = "#CCCCCC"
theme.GridScreenListNameColor = "#FFFFFF"
' Color values work here
theme.GridScreenDescriptionTitleColor = "#001090"
theme.GridScreenDescriptionDateColor = "#FF005B"
theme.GridScreenDescriptionRuntimeColor = "#5B005B"
theme.GridScreenDescriptionSynopsisColor = "#606000"
'used in the Grid Screen
theme.CounterTextLeft = "#FF0000"
theme.CounterSeparator = "#00FF00"
theme.CounterTextRight = "#0000FF"
theme.GridScreenLogoHD = "pkg:/images/Overhang_Test_HD.png"
theme.GridScreenLogoOffsetHD_X = "0"
theme.GridScreenLogoOffsetHD_Y = "0"
theme.GridScreenOverhangHeightHD = "99"
theme.GridScreenLogoSD = "pkg:/images/Overhang_Test_SD43.png"
theme.GridScreenOverhangHeightSD = "66"
theme.GridScreenLogoOffsetSD_X = "0"
theme.GridScreenLogoOffsetSD_Y = "0"
' to use your own focus ring artwork
'theme.GridScreenFocusBorderSD = "pkg:/images/GridCenter_Border_Movies_SD43.png"
'theme.GridScreenBorderOffsetSD = "(-26,-25)"
'theme.GridScreenFocusBorderHD = "pkg:/images/GridCenter_Border_Movies_HD.png"
'theme.GridScreenBorderOffsetHD = "(-28,-20)"
' to use your own description background artwork
'theme.GridScreenDescriptionImageSD = "pkg:/images/Grid_Description_Background_SD43.png"
'theme.GridScreenDescriptionOffsetSD = "(125,170)"
'theme.GridScreenDescriptionImageHD = "pkg:/images/Grid_Description_Background_HD.png"
'theme.GridScreenDescriptionOffsetHD = "(190,255)"
return theme
End Function
'******************************************************
'** Perform any startup/initialization stuff prior to
'** initially showing the screen.
'******************************************************
Function preShowGridScreen(style as string) As Object
m.port=CreateObject("roMessagePort")
screen = CreateObject("roGridScreen")
screen.SetMessagePort(m.port)
' screen.SetDisplayMode("best-fit")
screen.SetDisplayMode("scale-to-fill")
screen.SetGridStyle(style)
return screen
End Function
'******************************************************
'** Display the gird screen and wait for events from
'** the screen. The screen will show retreiving while
'** we fetch and parse the feeds for the show posters
'******************************************************
Function showGridScreen(screen As Object, gridstyle as string) As string
print "enter showGridScreen"
categoryList = getCategoryList()
categoryList[0] = "GridStyle: " + gridstyle
screen.setupLists(categoryList.count())
screen.SetListNames(categoryList)
StyleButtons = getGridControlButtons()
screen.SetContentList(0, StyleButtons)
for i = 1 to categoryList.count()-1
screen.SetContentList(i, getShowsForCategoryItem(categoryList[i]))
end for
screen.Show()
while true
print "Waiting for message"
msg = wait(0, m.port)
'msg = wait(0, screen.GetMessagePort()) ' getmessageport does not work on gridscreen
print "Got Message:";type(msg)
if type(msg) = "roGridScreenEvent" then
print "msg= "; msg.GetMessage() " , index= "; msg.GetIndex(); " data= "; msg.getData()
if msg.isListItemFocused() then
print"list item focused | current show = "; msg.GetIndex()
else if msg.isListItemSelected() then
row = msg.GetIndex()
selection = msg.getData()
print "list item selected row= "; row; " selection= "; selection
' Did we get a selection from the gridstyle selection row?
if (row = 0)
' yes, return so we can come back with new style
return StyleButtons[selection].Title
endif
'm.curShow = displayShowDetailScreen(showList[msg.GetIndex()])
else if msg.isScreenClosed() then
return ""
end if
end If
end while
End Function
'**********************************************************
'** When a poster on the home screen is selected, we call
'** this function passing an roAssociativeArray with the
'** ContentMetaData for the selected show. This data should
'** be sufficient for the springboard to display
'**********************************************************
Function displayShowDetailScreen(category as Object, showIndex as Integer) As Integer
'add code to create springboard, for now we do nothing
return 1
End Function
'**************************************************************
'** Return the list of categories to display in the filter
'** banner. The result is an roArray containing the names of
'** all of the categories. All just static data for the example.
'***************************************************************
Function getCategoryList() As Object
categoryList = [ "GridStyle", "Reality", "History", "News", "Comedy", "Drama"]
return categoryList
End Function
'********************************************************************
'** Given the category from the filter banner, return an array
'** of ContentMetaData objects (roAssociativeArray's) representing
'** the shows for the category. For this example, we just cheat and
'** create and return a static array with just the minimal items
'** set, but ideally, you'd go to a feed service, fetch and parse
'** this data dynamically, so content for each category is dynamic
'********************************************************************
Function getShowsForCategoryItem(category As Object) As Object
print "getting shows for category "; category
showList = [
{
Title: category + ": Header",
releaseDate: "1976",
length: 3600-600,
Description:"This row is category " + category,
hdBranded: true,
HDPosterUrl:"http://upload.wikimedia.org/wikipedia/commons/4/43/Gold_star_on_blue.gif",
SDPosterUrl:"http://upload.wikimedia.org/wikipedia/commons/4/43/Gold_star_on_blue.gif",
Description:"Short Synopsis #1",
Synopsis:"Length",
StarRating:10,
}
{
Title: category + ": Beverly Hillbillies",
releaseDate: "1969",
rating: "PG",
Description:"Come and listen to a story about a man named Jed: Poor mountaineer, barely kept his family fed. Then one day he was shootin at some food, and up through the ground came a bubblin crude. Oil that is, black gold, Texas tea.",
numEpisodes:42,
contentType:"season",
HDPosterUrl:"http://upload.wikimedia.org/wikipedia/en/4/4e/The_Beverly_Hillbillies.jpg",
SDPosterUrl:"http://upload.wikimedia.org/wikipedia/en/4/4e/The_Beverly_Hillbillies.jpg",
StarRating:80,
UserStarRating:40
}
{
Title: category + ": Babylon 5",
releaseDate: "1996",
rating: "PG",
Description:"The show centers on the Babylon 5 space station: a focal point for politics, diplomacy, and conflict during the years 2257-2262.",
numEpisodes:102,
contentType:"season",
HDPosterUrl:"http://upload.wikimedia.org/wikipedia/en/9/9d/Smb5-s4.jpg",
SDPosterUrl:"http://upload.wikimedia.org/wikipedia/en/9/9d/Smb5-s4.jpg",
StarRating:80,
UserStarRating:40
}
{
Title: category + ": John F. Kennedy",
releaseDate: "1961",
rating: "PG",
Description:"My fellow citizens of the world: ask not what America will do for you, but what together we can do for the freedom of man.",
HDPosterUrl:"http://upload.wikimedia.org/wikipedia/en/5/52/Jfk_happy_birthday_1.jpg",
SDPosterUrl:"http://upload.wikimedia.org/wikipedia/en/5/52/Jfk_happy_birthday_1.jpg",
StarRating:100
}
{
Title: category + ": Man on the Moon",
releaseDate: "1969",
rating: "PG",
Description:"That's one small step for a man, one giant leap for mankind.",
HDPosterUrl:"http://upload.wikimedia.org/wikipedia/commons/1/1e/Apollo_11_first_step.jpg",
SDPosterUrl:"http://upload.wikimedia.org/wikipedia/commons/1/1e/Apollo_11_first_step.jpg",
StarRating:100
}
{
Title: category + ": I have a Dream",
releaseDate: "1963",
rating: "PG",
Description:"I have a dream that my four little children will one day live in a nation where they will not be judged by the color of their skin, but by the content of their character.",
HDPosterUrl:"http://upload.wikimedia.org/wikipedia/commons/8/81/Martin_Luther_King_-_March_on_Washington.jpg",
SDPosterUrl:"http://upload.wikimedia.org/wikipedia/commons/8/81/Martin_Luther_King_-_March_on_Washington.jpg",
StarRating:100
}
]
return showList
End Function
function getGridControlButtons() as object
buttons = [
{ Title: "Flat-Movie"
ReleaseDate: "HD:5x2 SD:5x2"
Description: "Flat-Movie (Netflix) style"
HDPosterUrl:"http://upload.wikimedia.org/wikipedia/commons/4/43/Gold_star_on_blue.gif"
SDPosterUrl:"http://upload.wikimedia.org/wikipedia/commons/4/43/Gold_star_on_blue.gif"
}
{ Title: "Flat-Landscape"
ReleaseDate: "HD:5x3 SD:4x3"
Description: "Channel Store"
HDPosterUrl:"http://upload.wikimedia.org/wikipedia/commons/thumb/9/96/Dunkery_Hill.jpg/800px-Dunkery_Hill.jpg",
SDPosterUrl:"http://upload.wikimedia.org/wikipedia/commons/thumb/9/96/Dunkery_Hill.jpg/800px-Dunkery_Hill.jpg",
}
{ Title: "Flat-Portrait"
ReleaseDate: "HD:5x2 SD:5x2"
Description: "3x4 style posters"
HDPosterUrl:"http://upload.wikimedia.org/wikipedia/commons/9/9f/Kane_George_Gurnett.jpg",
SDPosterUrl:"http://upload.wikimedia.org/wikipedia/commons/9/9f/Kane_George_Gurnett.jpg",
}
{ Title: "Flat-Square"
ReleaseDate: "HD:7x3 SD:6x3"
Description: "1x1 style posters"
HDPosterUrl:"http://upload.wikimedia.org/wikipedia/commons/thumb/d/de/SQUARE_SHAPE.svg/536px-SQUARE_SHAPE.svg.png",
SDPosterUrl:"http://upload.wikimedia.org/wikipedia/commons/thumb/d/de/SQUARE_SHAPE.svg/536px-SQUARE_SHAPE.svg.png",
}
{ Title: "Flat-16x9"
ReleaseDate: "HD:5x3 SD:4x3"
Description: "HD style posters"
HDPosterUrl:"http://upload.wikimedia.org/wikipedia/commons/thumb/2/22/%C3%89cran_TV_plat.svg/200px-%C3%89cran_TV_plat.svg.png",
SDPosterUrl:"http://upload.wikimedia.org/wikipedia/commons/thumb/2/22/%C3%89cran_TV_plat.svg/200px-%C3%89cran_TV_plat.svg.png",
}
]
return buttons
End Function

View File

@@ -0,0 +1,31 @@
function [ error ] = cross_validation(x,y,hyper_parameter)
num_data = size(x,1);
K = 10;
indices = crossvalind('Kfold', num_data, K);
errors = zeros(K,1);
for i = 1:K
% get indices
test_idx = (indices == i);
train_idx = ~test_idx;
% get training data
x_train = x(train_idx,:);
y_train = y(train_idx,:);
% train
w = train(x_train, y_train, hyper_parameter);
% get test data
x_test = x(test_idx,:);
y_test = y(test_idx,:);
% calculate error
errors(i) = calc_cost(x_test, y_test, w, hyper_parameter); %calc_error
%errors(i) = calc_error(x_test, y_test, w);
end
error = mean(errors);
end

View File

@@ -0,0 +1,6 @@
function [ d, d_mean, d_std ] = normalize( d )
d_mean = mean(d);
d = d - repmat(d_mean, size(d,1), 1);
d_std = std(d);
d = d./ repmat(d_std, size(d,1), 1);
end

View File

@@ -0,0 +1,55 @@
patches-own [
living? ;; indicates if the cell is living
live-neighbors ;; counts how many neighboring cells are alive
]
to setup-blank
clear-all
ask patches [ cell-death ]
reset-ticks
end
to setup-random
clear-all
ask patches
[ ifelse random-float 100.0 < initial-density
[ cell-birth ]
[ cell-death ] ]
reset-ticks
end
to cell-birth
set living? true
set pcolor fgcolor
end
to cell-death
set living? false
set pcolor bgcolor
end
to go
ask patches
[ set live-neighbors count neighbors with [living?] ]
;; Starting a new "ask patches" here ensures that all the patches
;; finish executing the first ask before any of them start executing
;; the second ask. This keeps all the patches in synch with each other,
;; so the births and deaths at each generation all happen in lockstep.
ask patches
[ ifelse live-neighbors = 3
[ cell-birth ]
[ if live-neighbors != 2
[ cell-death ] ] ]
tick
end
to draw-cells
let erasing? [living?] of patch mouse-xcor mouse-ycor
while [mouse-down?]
[ ask patch mouse-xcor mouse-ycor
[ ifelse erasing?
[ cell-death ]
[ cell-birth ] ]
display ]
end

View File

@@ -0,0 +1,644 @@
/*
* Copyright (c) 2008, 2013 Dainius "GreatEmerald" Masiliūnas
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//-----------------------------------------------------------------------------
// MutU2Weapons.uc
// Mutator class for replacing weapons
// GreatEmerald, 2008
//-----------------------------------------------------------------------------
class MutU2Weapons extends Mutator
config(U2Weapons);
var() config string ReplacedWeaponClassNames0;
var() config string ReplacedWeaponClassNames1, ReplacedWeaponClassNames2, ReplacedWeaponClassNames3;
var() config string ReplacedWeaponClassNames4, ReplacedWeaponClassNames5, ReplacedWeaponClassNames6;
var() config string ReplacedWeaponClassNames7, ReplacedWeaponClassNames8, ReplacedWeaponClassNames9;
var() config string ReplacedWeaponClassNames10, ReplacedWeaponClassNames11, ReplacedWeaponClassNames12;
var() config bool bConfigUseU2Weapon0, bConfigUseU2Weapon1, bConfigUseU2Weapon2, bConfigUseU2Weapon3;
var() config bool bConfigUseU2Weapon4, bConfigUseU2Weapon5, bConfigUseU2Weapon6, bConfigUseU2Weapon7;
var() config bool bConfigUseU2Weapon8, bConfigUseU2Weapon9, bConfigUseU2Weapon10, bConfigUseU2Weapon11;
var() config bool bConfigUseU2Weapon12;
//var byte bUseU2Weapon[13];
//var class<Weapon> ReplacedWeaponClasses[13];
//var class<WeaponPickup> ReplacedWeaponPickupClasses[13];
//var class<Ammo> ReplacedAmmoPickupClasses[13];
var class<Weapon> U2WeaponClasses[13]; //GE: For default properties ONLY!
//var string U2WeaponPickupClassNames[13];
var string U2AmmoPickupClassNames[13]; //GE: For default properties ONLY!
var byte bIsVehicle[13], bNotVehicle[13]; //GE: For default properties ONLY!
var localized string U2WeaponDisplayText[33], U2WeaponDescText[33];
//var localized string GUISelectOptions[4];
//var config int FirePowerMode;
var config bool bExperimental;
var config bool bUseFieldGenerator;
var config bool bUseProximitySensor;
var config bool bIntegrateShieldReward;
var int IterationNum; //GE: Weapons.Length
const DamageMultiplier=1.818182;
var config int DamagePercentage;
var config bool bUseXMPFeel;
var config string FlashbangModeString;
struct WeaponInfo
{
var class<Weapon> ReplacedWeaponClass; //GE: Generated from ReplacedWeaponClassName. This is what we replace.
//var class<WeaponPickup> ReplacedWeaponPickupClass; //GE: UNUSED?!
var class<Ammo> ReplacedAmmoPickupClass; //GE: Generated from ReplacedWeaponClassName.
var class<Weapon> WeaponClass; //GE: This is the weapon we are going to put inside the world.
var string WeaponPickupClassName; //GE: Generated from WeponClass.
var string AmmoPickupClassName; //GE: Generated from WeaponClass.
var bool bEnabled; //GE: Structs can't be defaultproperty'd, thus we still require bConfigUseU2WeaponX
var bool bIsVehicle; //GE: This indicates that the weapon spawns a vehicle (deployable turrets). These only work in vehicle gametypes, duh.
var bool bNotVehicle; //GE: Opposite of bIsVehicle, that is, only works in non-vehicle gametypes. Think shotgun.
};
var WeaponInfo Weapons[13];
/*
* GE: Here we initialise the mutator. First of all, structs can't use defaultproperties (until UE3) and thus config, so here we need to initialise the structs.
*/
function PostBeginPlay()
{
local int FireMode, x;
//local string ReplacedWeaponPickupClassName;
//IterationNum = ArrayCount(ReplacedWeaponClasses) - int(Level.Game.bAllowVehicles); //GE: He he, neat way to get the required number.
IterationNum = ArrayCount(Weapons);
for (x = 0; x < IterationNum; x++)
{
Weapons[x].bEnabled = bool(GetPropertyText("bConfigUseU2Weapon"$x)); //GE: GetPropertyText() is needed to use variables in an array-like fashion.
//bUseU2Weapon[x] = byte(bool(GetPropertyText("bConfigUseU2Weapon"$x)));
Weapons[x].ReplacedWeaponClass = class<Weapon>(DynamicLoadObject(GetPropertyText("ReplacedWeaponClassNames"$x),class'Class'));
//ReplacedWeaponClasses[x] = class<Weapon>(DynamicLoadObject(GetPropertyText("ReplacedWeaponClassNames"$x),class'Class'));
//ReplacedWeaponPickupClassName = string(ReplacedWeaponClasses[x].default.PickupClass);
for(FireMode = 0; FireMode<2; FireMode++)
{
if( (Weapons[x].ReplacedWeaponClass.default.FireModeClass[FireMode] != None)
&& (Weapons[x].ReplacedWeaponClass.default.FireModeClass[FireMode].default.AmmoClass != None)
&& (Weapons[x].ReplacedWeaponClass.default.FireModeClass[FireMode].default.AmmoClass.default.PickupClass != None) )
{
Weapons[x].ReplacedAmmoPickupClass = class<Ammo>(Weapons[x].ReplacedWeaponClass.default.FireModeClass[FireMode].default.AmmoClass.default.PickupClass);
break;
}
}
Weapons[x].WeaponClass = U2WeaponClasses[x];
Weapons[x].WeaponPickupClassName = string(Weapons[x].WeaponClass.default.PickupClass);
Weapons[x].AmmoPickupClassName = U2AmmoPickupClassNames[x];
Weapons[x].bIsVehicle = bool(bIsVehicle[x]);
Weapons[x].bNotVehicle = bool(bNotVehicle[x]);
}
Super.PostBeginPlay();
}
/*
* GE: Utility function for checking if we can replace the item with the weapon/ammo of choice.
*/
function bool ValidReplacement(int x)
{
if (Level.Game.bAllowVehicles)
return (Weapons[x].bEnabled && !Weapons[x].bNotVehicle );
return (Weapons[x].bEnabled && !Weapons[x].bIsVehicle);
}
/*
* GE: Here we replace things.
*/
function bool CheckReplacement( Actor Other, out byte bSuperRelevant )
{
local int x, i;
local WeaponLocker L;
bSuperRelevant = 0;
if (xWeaponBase(Other) != None)
{
for (x = 0; x < IterationNum; x++)
{
if (ValidReplacement(x) && xWeaponBase(Other).WeaponType == Weapons[x].ReplacedWeaponClass)
{
xWeaponBase(Other).WeaponType = Weapons[x].WeaponClass;
return false;
}
}
return true;
}
if (Weapon(Other) != None)
{
if ( Other.IsA('BallLauncher') )
return true;
for (x = 0; x < IterationNum; x++)
if (ValidReplacement(x) && Other.Class == Weapons[x].ReplacedWeaponClass)
return false;
return true;
}
/*if (WeaponPickup(Other) != None) //GE: This should never happen.
{
for (x = 0; x < IterationNum; x++)
{
if (Weapons[x].bEnabled && Other.Class == Weapons[x].ReplacedWeaponPickupClass)
{
ReplaceWith(Other, U2WeaponPickupClassNames[x]);
return false;
}
}
} */
if (Ammo(Other) != None)
{
for (x = 0; x < IterationNum; x++)
{
if (ValidReplacement(x) && Other.Class == Weapons[x].ReplacedAmmoPickupClass)
{
ReplaceWith(Other, Weapons[x].AmmoPickupClassName);
return false;
}
}
return true;
}
if (WeaponLocker(Other) != None)
{
L = WeaponLocker(Other);
for (x = 0; x < IterationNum; x++)
if (ValidReplacement(x))
for (i = 0; i < L.Weapons.Length; i++)
if (L.Weapons[i].WeaponClass == Weapons[x].ReplacedWeaponClass)
L.Weapons[i].WeaponClass = Weapons[x].WeaponClass;
return true;
}
//STARTING WEAPON
if( xPawn(Other) != None )
xPawn(Other).RequiredEquipment[0] = string(Weapons[1].WeaponClass);
if( xPawn(Other) != None && bUseFieldGenerator == True && Level.Game.bAllowVehicles)
xPawn(Other).RequiredEquipment[2] = "U2Weapons.U2WeaponFieldGenerator";
if( xPawn(Other) != None && bUseProximitySensor == True && Level.Game.bAllowVehicles)
xPawn(Other).RequiredEquipment[3] = "U2Weapons.U2ProximitySensorDeploy";
//GE: Special handling - Shield Reward integration
if (bIntegrateShieldReward && Other.IsA('ShieldReward'))
{
ShieldPack(Other).SetStaticMesh(StaticMesh'XMPWorldItemsM.items.Pickup_TD_001');
ShieldPack(Other).Skins[0] = Shader'U2343T.Pickups.Energy_Pickup_B_FX_01';
ShieldPack(Other).RepSkin = Shader'U2343T.Pickups.Energy_Pickup_B_FX_01';
ShieldPack(Other).SetDrawScale(0.35);
ShieldPack(Other).SetCollisionSize(27.0, 4.0);
ShieldPack(Other).PickupMessage = "You got an Energy Pickup.";
ShieldPack(Other).PickupSound = Sound'U2A.Powerups.EnergyPowerUp';
}
return Super.CheckReplacement(Other,bSuperRelevant);
}
/*
* GE: This is for further replacement, I think...
*/
function string GetInventoryClassOverride(string InventoryClassName)
{
local int x;
for (x = 0; x < IterationNum; x++)
{
if (InventoryClassName ~= string(Weapons[x].ReplacedWeaponClass) && ValidReplacement(x))
return string(Weapons[x].WeaponClass);
}
return Super.GetInventoryClassOverride(InventoryClassName);
}
/*
* GE: Configuration options.
*/
static function FillPlayInfo(PlayInfo PlayInfo)
{
local array<CacheManager.WeaponRecord> Recs;
local string WeaponOptions;
local int i;
Super.FillPlayInfo(PlayInfo);
class'CacheManager'.static.GetWeaponList(Recs);
for (i = 0; i < Recs.Length; i++)
{
if (WeaponOptions != "")
WeaponOptions $= ";";
WeaponOptions $= Recs[i].ClassName $ ";" $ Recs[i].FriendlyName;
}
PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon0", default.U2WeaponDisplayText[0], 0, 3, "Check");
PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames0", default.U2WeaponDisplayText[1], 0, 4, "Select", WeaponOptions);
PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon1", default.U2WeaponDisplayText[2], 0, 5, "Check");
PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames1", default.U2WeaponDisplayText[3], 0, 6, "Select", WeaponOptions);
PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon2", default.U2WeaponDisplayText[6], 0, 7, "Check");
PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames2", default.U2WeaponDisplayText[7], 0, 8, "Select", WeaponOptions);
PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon3", default.U2WeaponDisplayText[8], 0, 9, "Check");
PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames3", default.U2WeaponDisplayText[9], 0, 10, "Select", WeaponOptions);
PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon4", default.U2WeaponDisplayText[10], 0, 11, "Check");
PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames4", default.U2WeaponDisplayText[11], 0, 12, "Select", WeaponOptions);
PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon5", default.U2WeaponDisplayText[12], 0, 13, "Check");
PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames5", default.U2WeaponDisplayText[13], 0, 14, "Select", WeaponOptions);
PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon6", default.U2WeaponDisplayText[14], 0, 15, "Check");
PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames6", default.U2WeaponDisplayText[15], 0, 16, "Select", WeaponOptions);
PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon7", default.U2WeaponDisplayText[16], 0, 17, "Check");
PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames7", default.U2WeaponDisplayText[17], 0, 18, "Select", WeaponOptions);
PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon8", default.U2WeaponDisplayText[18], 0, 19, "Check");
PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames8", default.U2WeaponDisplayText[19], 0, 20, "Select", WeaponOptions);
PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon9", default.U2WeaponDisplayText[20], 0, 21, "Check");
PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames9", default.U2WeaponDisplayText[21], 0, 22, "Select", WeaponOptions);
PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon10", default.U2WeaponDisplayText[22], 0, 23, "Check");
PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames10", default.U2WeaponDisplayText[23], 0, 24, "Select", WeaponOptions);
PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon11", default.U2WeaponDisplayText[24], 0, 25, "Check");
PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames11", default.U2WeaponDisplayText[25], 0, 26, "Select", WeaponOptions);
PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon12", default.U2WeaponDisplayText[26], 0, 27, "Check");
PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames12", default.U2WeaponDisplayText[27], 0, 28, "Select", WeaponOptions);
PlayInfo.AddSetting(default.RulesGroup, "bUseXMPFeel", default.U2WeaponDisplayText[4], 0, 29, "Check");
PlayInfo.AddSetting(default.RulesGroup, "DamagePercentage", default.U2WeaponDisplayText[30], 0, 30, "Text", "3;0:100");
PlayInfo.AddSetting(default.RulesGroup, "bExperimental", default.U2WeaponDisplayText[5], 0, 31, "Check");
PlayInfo.AddSetting(default.RulesGroup, "bUseFieldGenerator", default.U2WeaponDisplayText[28], 0, 32, "Check");
PlayInfo.AddSetting(default.RulesGroup, "bUseProximitySensor", default.U2WeaponDisplayText[29], 0, 33, "Check");
PlayInfo.AddSetting(default.RulesGroup, "bIntegrateShieldReward", default.U2WeaponDisplayText[31], 0, 34, "Check");
PlayInfo.AddSetting(default.RulesGroup, "FlashbangModeString", default.U2WeaponDisplayText[32], 0, 35, "Select", "FM_None;None;FM_Directional;Direction-based;FM_DistanceBased;Distance-based");
}
/*
* GE: Configuration tooltips.
*/
static event string GetDescriptionText(string PropName)
{
if (PropName == "bConfigUseU2Weapon0")
return default.U2WeaponDescText[0];
if (PropName == "ReplacedWeaponClassNames0")
return default.U2WeaponDescText[1];
if (PropName == "bConfigUseU2Weapon1")
return default.U2WeaponDescText[2];
if (PropName == "ReplacedWeaponClassNames1")
return default.U2WeaponDescText[3];
if (PropName == "bConfigUseU2Weapon2")
return default.U2WeaponDescText[6];
if (PropName == "ReplacedWeaponClassNames2")
return default.U2WeaponDescText[7];
if (PropName == "bConfigUseU2Weapon3")
return default.U2WeaponDescText[8];
if (PropName == "ReplacedWeaponClassNames3")
return default.U2WeaponDescText[9];
if (PropName == "bConfigUseU2Weapon4")
return default.U2WeaponDescText[10];
if (PropName == "ReplacedWeaponClassNames4")
return default.U2WeaponDescText[11];
if (PropName == "bConfigUseU2Weapon5")
return default.U2WeaponDescText[12];
if (PropName == "ReplacedWeaponClassNames5")
return default.U2WeaponDescText[13];
if (PropName == "bConfigUseU2Weapon6")
return default.U2WeaponDescText[14];
if (PropName == "ReplacedWeaponClassNames6")
return default.U2WeaponDescText[15];
if (PropName == "bConfigUseU2Weapon7")
return default.U2WeaponDescText[16];
if (PropName == "ReplacedWeaponClassNames7")
return default.U2WeaponDescText[17];
if (PropName == "bConfigUseU2Weapon8")
return default.U2WeaponDescText[18];
if (PropName == "ReplacedWeaponClassNames8")
return default.U2WeaponDescText[19];
if (PropName == "bConfigUseU2Weapon9")
return default.U2WeaponDescText[20];
if (PropName == "ReplacedWeaponClassNames9")
return default.U2WeaponDescText[21];
if (PropName == "bConfigUseU2Weapon10")
return default.U2WeaponDescText[22];
if (PropName == "ReplacedWeaponClassNames10")
return default.U2WeaponDescText[23];
if (PropName == "bConfigUseU2Weapon11")
return default.U2WeaponDescText[24];
if (PropName == "ReplacedWeaponClassNames11")
return default.U2WeaponDescText[25];
if (PropName == "bConfigUseU2Weapon12")
return default.U2WeaponDescText[26];
if (PropName == "ReplacedWeaponClassNames12")
return default.U2WeaponDescText[27];
if (PropName == "bUseXMPFeel")
return default.U2WeaponDescText[4];
if (PropName == "bExperimental")
return default.U2WeaponDescText[5];
if (PropName == "bUseFieldGenerator")
return default.U2WeaponDescText[28];
if (PropName == "bUseProximitySensor")
return default.U2WeaponDescText[29];
if (PropName == "DamagePercentage")
return default.U2WeaponDescText[30];
if (PropName == "bIntegrateShieldReward")
return default.U2WeaponDescText[31];
if (PropName == "FlashbangModeString")
return default.U2WeaponDescText[32];
return Super.GetDescriptionText(PropName);
}
/*
* GE: Here we set all the properties for different play styles.
*/
event PreBeginPlay()
{
//local int x;
//local class<Weapon> Weapons;
local float k; //GE: Multiplier.
Super.PreBeginPlay();
k=float(DamagePercentage)/100.0;
//log("MutU2Weapons: k is"@k);
//Sets various settings that match different games
/*if (FirePowerMode == 1) { //Original XMP - use the UTXMP original values
k=1;
}
else */if (!bUseXMPFeel && DamagePercentage != class'MutU2Weapons'.default.DamagePercentage) { //Original U2; compensate for float division errors
Class'U2Weapons.U2AssaultRifleFire'.default.DamageMin *= DamageMultiplier * k;
Class'U2Weapons.U2AssaultRifleFire'.default.DamageMax *= DamageMultiplier * k;
Class'U2Weapons.U2AssaultRifleProjAlt'.default.Damage *= DamageMultiplier * k;
Class'U2Weapons.U2ProjectileASExplAlt'.default.Damage *= DamageMultiplier * k;
Class'U2Weapons.U2ProjectileAltEnergyRifle'.default.Damage *= DamageMultiplier * k;
Class'U2Weapons.U2ProjectileEnergyRifle'.default.Damage *= DamageMultiplier * k;
Class'U2Weapons.U2FireFlameThrower'.default.DamageMin *= DamageMultiplier * k;
Class'U2Weapons.U2FireFlameThrower'.default.DamageMax *= DamageMultiplier * k;
Class'U2Weapons.U2ProjectileFragGrenade'.default.Damage *= DamageMultiplier * k;
Class'U2Weapons.U2ProjectileIncendiaryGrenade'.default.Damage *= DamageMultiplier * k;
Class'U2Weapons.U2ProjectileConcussionGrenade'.default.Damage *= DamageMultiplier * k;
Class'U2Weapons.U2ProjectileRocketDrunken'.default.Damage *= DamageMultiplier * k;
Class'U2Weapons.U2ProjectileRocketSeeking'.default.Damage *= DamageMultiplier * k;
Class'U2Weapons.U2ProjectileRocket'.default.Damage *= DamageMultiplier * k;
Class'U2Weapons.U2ProjectileAltShotgun'.default.Damage *= DamageMultiplier * k;
Class'U2Weapons.U2FireShotgun'.default.DamageMin *= DamageMultiplier * k;
Class'U2Weapons.U2FireShotgun'.default.DamageMax *= DamageMultiplier * k;
Class'U2Weapons.U2FireSniper'.default.DamageMin *= DamageMultiplier * k;
Class'U2Weapons.U2FireSniper'.default.DamageMax *= DamageMultiplier * k;
Class'U2Weapons.U2FirePistol'.default.DamageMin *= DamageMultiplier * k;
Class'U2Weapons.U2FirePistol'.default.DamageMax *= DamageMultiplier * k;
Class'U2Weapons.U2FireAltPistol'.default.DamageMin *= DamageMultiplier * k;
Class'U2Weapons.U2FireAltPistol'.default.DamageMax *= DamageMultiplier * k;
Class'U2Weapons.U2ProjectileEMPGrenade'.default.Damage *= DamageMultiplier * k;
Class'U2Weapons.U2ProjectileToxicGrenade'.default.Damage *= DamageMultiplier * k;
Class'U2Weapons.U2HurterProxy_Gas'.default.myDamage *= DamageMultiplier * k;
Class'U2Weapons.U2HurterProxy_Fire'.default.myDamage *= DamageMultiplier * k;
}
//Dampened U2 is already the default - no need for a rewrite?
else if (bUseXMPFeel) { //General XMP
Class'U2Weapons.U2AssaultRifleFire'.default.Spread = 6.0;
Class'U2Weapons.U2AssaultRifleAmmoInv'.default.MaxAmmo = 300;
Class'U2Weapons.U2AssaultRifleProjAlt'.default.Speed = 5000;
Class'U2Weapons.U2AssaultRifleProjAlt'.default.MomentumTransfer = 8000;
Class'U2Weapons.U2WeaponEnergyRifle'.default.ClipSize = 30;
Class'U2Weapons.U2FireAltEnergyRifle'.default.FireLastReloadTime = 2.265000;
Class'U2Weapons.U2ProjectileAltEnergyRifle'.default.Speed = 1400.000000;
Class'U2Weapons.U2ProjectileAltEnergyRifle'.default.DamageRadius = 290.000000;
Class'U2Weapons.U2ProjectileAltEnergyRifle'.default.LifeSpan = 6.0;
Class'U2Weapons.U2ProjectileEnergyRifle'.default.ShakeRadius = 1024.0;
Class'U2Weapons.U2ProjectileEnergyRifle'.default.ShakeMagnitude = 1.0;
Class'U2Weapons.U2ProjectileEnergyRifle'.default.Speed = 2500.0;
Class'U2Weapons.U2ProjectileEnergyRifle'.default.MaxSpeed = 5000.0;
Class'U2Weapons.U2ProjectileEnergyRifle'.default.LifeSpan = 6.0;
Class'U2Weapons.U2AmmoEnergyRifle'.default.MaxAmmo = 150;
Class'U2Weapons.U2FireAltFlameThrower'.default.FireRate = 0.25;
Class'U2Weapons.U2ProjectileAltFlameThrower'.default.MaxSpeed = 500.0;
Class'U2Weapons.U2ProjectileAltFlameThrower'.default.LifeSpan = 22.0;
Class'U2Weapons.U2ProjectileAltFlameThrower'.default.MomentumTransfer = 500.0;
Class'U2Weapons.U2WeaponFlameThrower'.default.ClipSize = 80;
Class'U2Weapons.U2WeaponFlameThrower'.default.ReloadTime = 2.0;
Class'U2Weapons.U2AmmoFlameThrower'.default.MaxAmmo = 480;
Class'U2Weapons.U2ProjectileFragGrenade'.default.MomentumTransfer = 9000;
Class'U2Weapons.U2ProjectileFragGrenade'.default.MaxSpeed = 2600.0;
Class'U2Weapons.U2ProjectileFragGrenade'.default.Speed = 2600.0;
Class'U2Weapons.U2ProjectileSmokeGrenade'.default.MaxSpeed = 2600.0;
Class'U2Weapons.U2ProjectileSmokeGrenade'.default.Speed = 2600.0;
Class'U2Weapons.U2ProjectileIncendiaryGrenade'.default.DamageRadius = 256.0;
Class'U2Weapons.U2ProjectileIncendiaryGrenade'.default.MomentumTransfer = 9000.0;
Class'U2Weapons.U2ProjectileConcussionGrenade'.default.DamageRadius = 180.0;
Class'U2Weapons.U2FireGrenade'.default.FireRate = 1.33;
Class'U2Weapons.U2WeaponRocketLauncher'.default.ReloadTime = 2.0;
Class'U2Weapons.U2AmmoRocketLauncher'.default.MaxAmmo = 25;
Class'U2Weapons.U2ProjectileRocketDrunken'.default.Speed = 1200.0;
Class'U2Weapons.U2ProjectileRocketSeeking'.default.Speed = 1200.0;
Class'U2Weapons.U2ProjectileRocket'.default.Speed = 2133.0;//3200 is too much
Class'U2Weapons.U2ProjectileRocket'.default.MaxSpeed = 2133.0;
Class'U2Weapons.U2ProjectileRocket'.default.DamageRadius = 384.0;
Class'U2Weapons.U2WeaponShotgun'.default.ReloadTime = 2.21;
Class'U2Weapons.U2WeaponShotgun'.default.ClipSize = 6;
Class'U2Weapons.U2AmmoShotgun'.default.MaxAmmo = 42;
Class'U2Weapons.U2WeaponSniper'.default.ClipSize = 3;
Class'U2Weapons.U2FireSniper'.default.FireRate = 1.0;
Class'U2Weapons.U2AmmoSniper'.default.MaxAmmo = 18;
Class'U2Weapons.U2FirePistol'.default.FireLastReloadTime = 2.4;
Class'U2Weapons.U2FireAltPistol'.default.FireLastReloadTime = 2.4;
Class'U2Weapons.U2AmmoPistol'.default.MaxAmmo = 45;
Class'U2Weapons.U2DamTypePistol'.default.VehicleDamageScaling = 0.30;
Class'U2Weapons.U2DamTypeAltPistol'.default.VehicleDamageScaling = 0.30;
Class'U2Weapons.U2AssaultRifleFire'.default.DamageMin = 20*k;
Class'U2Weapons.U2AssaultRifleFire'.default.DamageMax = 20*k;
Class'U2Weapons.U2AssaultRifleProjAlt'.default.Damage = 175*k;
Class'U2Weapons.U2ProjectileASExplAlt'.default.Damage = 64.0*k;
Class'U2Weapons.U2ProjectileAltEnergyRifle'.default.Damage = 120.0*k;
Class'U2Weapons.U2ProjectileEnergyRifle'.default.Damage = 13.0*k;
Class'U2Weapons.U2FireFlameThrower'.default.DamageMin = 15*k;
Class'U2Weapons.U2FireFlameThrower'.default.DamageMax = 15*k;
Class'U2Weapons.U2ProjectileFragGrenade'.default.Damage = 200.0*k;
Class'U2Weapons.U2ProjectileIncendiaryGrenade'.default.Damage = 50.0*k;
Class'U2Weapons.U2ProjectileConcussionGrenade'.default.Damage = 15.0*k;
Class'U2Weapons.U2ProjectileRocketDrunken'.default.Damage = 70.0*k;
Class'U2Weapons.U2ProjectileRocketSeeking'.default.Damage = 70.0*k;
Class'U2Weapons.U2ProjectileRocket'.default.Damage = 190.0*k;
Class'U2Weapons.U2ProjectileAltShotgun'.default.Damage = 22.0*k;
Class'U2Weapons.U2FireShotgun'.default.DamageMin = 16*k;
Class'U2Weapons.U2FireShotgun'.default.DamageMax = 16*k;
Class'U2Weapons.U2FireSniper'.default.DamageMin = 75*k;
Class'U2Weapons.U2FireSniper'.default.DamageMax = 75*k;
Class'U2Weapons.U2FirePistol'.default.DamageMin = 40*k;
Class'U2Weapons.U2FirePistol'.default.DamageMax = 40*k;
Class'U2Weapons.U2FireAltPistol'.default.DamageMin = 65*k;
Class'U2Weapons.U2FireAltPistol'.default.DamageMax = 65*k;
Class'U2Weapons.U2ProjectileEMPGrenade'.default.Damage = 140.0*k;
Class'U2Weapons.U2ProjectileToxicGrenade'.default.Damage = 100.0*k;
Class'U2Weapons.U2HurterProxy_Gas'.default.myDamage = 30.0*k;
Class'U2Weapons.U2HurterProxy_Fire'.default.myDamage = 80.0*k;
}
//
//-----------------------------------------------------------
//
//Experimental options - lets you Unuse EMPimp projectile and fire from two CAR barrels
if ((bExperimental) && (!bUseXMPFeel)) { //General U2
Class'U2Weapons.U2ProjectileAltEnergyRifle'.default.LifeSpan = 2.0;
Class'U2Weapons.U2ProjectileAltEnergyRifle'.default.Damage = 210.0*k;
}
if (bExperimental) { //CAR - nothing's setting it, FireMode independent
Class'U2Weapons.U2AssaultRifleFire'.default.bModeExclusive = false;
Class'U2Weapons.U2AssaultRifleAltFire'.default.bModeExclusive = false;
}
class'U2ProjectileConcussionGrenade'.static.SetFlashbangMode(FlashbangModeString);
}
defaultproperties
{
ReplacedWeaponClassNames0="XWeapons.Minigun"
ReplacedWeaponClassNames1="XWeapons.AssaultRifle"
ReplacedWeaponClassNames2="XWeapons.BioRifle"
ReplacedWeaponClassNames3="XWeapons.ShockRifle"
ReplacedWeaponClassNames4="Onslaught.ONSGrenadeLauncher"
ReplacedWeaponClassNames5="XWeapons.RocketLauncher"
ReplacedWeaponClassNames6="XWeapons.FlakCannon"
ReplacedWeaponClassNames7="XWeapons.SniperRifle"
ReplacedWeaponClassNames8="UTClassic.ClassicSniperRifle"
ReplacedWeaponClassNames9="Onslaught.ONSMineLayer"
ReplacedWeaponClassNames10="XWeapons.Redeemer"
ReplacedWeaponClassNames11="XWeapons.Painter"
ReplacedWeaponClassNames12="XWeapons.LinkGun"
bConfigUseU2Weapon0=True
bConfigUseU2Weapon1=True
bConfigUseU2Weapon2=True
bConfigUseU2Weapon3=True
bConfigUseU2Weapon4=True
bConfigUseU2Weapon5=True
bConfigUseU2Weapon6=True
bConfigUseU2Weapon7=True
bConfigUseU2Weapon8=True
bConfigUseU2Weapon9=True
bConfigUseU2Weapon10=True
bConfigUseU2Weapon11=True
bConfigUseU2Weapon12=True
bUseFieldGenerator=True
bUseProximitySensor=True
U2WeaponClasses(0)=Class'U2Weapons.U2AssaultRifleInv'
U2WeaponClasses(1)=Class'U2Weapons.U2WeaponEnergyRifle'
U2WeaponClasses(2)=Class'U2Weapons.U2WeaponFlameThrower'
U2WeaponClasses(3)=Class'U2Weapons.U2WeaponPistol'
U2WeaponClasses(4)=Class'U2Weapons.U2AutoTurretDeploy'
U2WeaponClasses(5)=Class'U2Weapons.U2WeaponRocketLauncher'
U2WeaponClasses(6)=Class'U2Weapons.U2WeaponGrenadeLauncher'
U2WeaponClasses(7)=Class'U2Weapons.U2WeaponSniper'
U2WeaponClasses(8)=Class'U2Weapons.U2WeaponSniper'
U2WeaponClasses(9)=Class'U2Weapons.U2WeaponRocketTurret'
U2WeaponClasses(10)=Class'U2Weapons.U2WeaponLandMine'
U2WeaponClasses(11)=Class'U2Weapons.U2WeaponLaserTripMine'
U2WeaponClasses(12)=Class'U2Weapons.U2WeaponShotgun' //GE: Has to be in !Level.Game.bAllowVehicles
bIsVehicle(0)=0
bIsVehicle(1)=0
bIsVehicle(2)=0
bIsVehicle(3)=0
bIsVehicle(4)=1
bIsVehicle(5)=0
bIsVehicle(6)=0
bIsVehicle(7)=0
bIsVehicle(8)=0
bIsVehicle(9)=1
bIsVehicle(10)=1
bIsVehicle(11)=1
bIsVehicle(12)=0
bNotVehicle(12)=1
U2AmmoPickupClassNames(0)="U2Weapons.U2AssaultRifleAmmoPickup"
U2AmmoPickupClassNames(1)="U2Weapons.U2PickupAmmoEnergyRifle"
U2AmmoPickupClassNames(2)="U2Weapons.U2PickupAmmoFlameThrower"
U2AmmoPickupClassNames(3)="U2Weapons.U2PickupAmmoPistol"
U2AmmoPickupClassNames(4)="U2Weapons.U2PickupAutoTurret"
U2AmmoPickupClassNames(5)="U2Weapons.U2PickupAmmoRocket"
U2AmmoPickupClassNames(6)="U2Weapons.U2PickupAmmoGrenade"
U2AmmoPickupClassNames(7)="U2Weapons.U2PickupAmmoSniper"
U2AmmoPickupClassNames(8)="U2Weapons.U2PickupAmmoSniper"
U2AmmoPickupClassNames(9)="U2Weapons.U2PickupRocketTurret"
U2AmmoPickupClassNames(10)="U2Weapons.U2PickupLandMine"
U2AmmoPickupClassNames(11)="U2Weapons.U2PickupLaserTripMine"
U2AmmoPickupClassNames(12)="U2Weapons.U2PickupAmmoShotgun"
U2WeaponDisplayText(0)="Include the Combat Assault Rifle"
U2WeaponDisplayText(1)="Replace this with the M32 Duster CAR"
U2WeaponDisplayText(2)="Include the Shock Lance"
U2WeaponDisplayText(3)="Replace this with the Shock Lance"
U2WeaponDisplayText(4)="Use XMP-style fire power?"
U2WeaponDisplayText(5)="Use alternative options?"
U2WeaponDisplayText(6)="Include the Flamethrower"
U2WeaponDisplayText(7)="Replace this with the Vulcan"
U2WeaponDisplayText(8)="Include the Magnum Pistol"
U2WeaponDisplayText(9)="Replace this with the Magnum Pistol"
U2WeaponDisplayText(10)="Include the Auto Turret"
U2WeaponDisplayText(11)="Replace this with the Auto Turret"
U2WeaponDisplayText(12)="Include the Shark Rocket Launcher"
U2WeaponDisplayText(13)="Replace this with the Shark"
U2WeaponDisplayText(14)="Include the Grenade Launcher"
U2WeaponDisplayText(15)="Replace this with the Hydra"
U2WeaponDisplayText(16)="Include the Widowmaker Sniper (1)"
U2WeaponDisplayText(17)="Replace this with the Widowmaker Rifle"
U2WeaponDisplayText(18)="Include the Widowmaker Sniper (2)"
U2WeaponDisplayText(19)="Replace this with the Widowmaker Rifle too"
U2WeaponDisplayText(20)="Include the Rocket Turret"
U2WeaponDisplayText(21)="Replace this with the Rocket Turret"
U2WeaponDisplayText(22)="Include the Land Mine"
U2WeaponDisplayText(23)="Replace this with the Land Mine"
U2WeaponDisplayText(24)="Include the Laser Trip Mine"
U2WeaponDisplayText(25)="Replace this with the Laser Trip Mine"
U2WeaponDisplayText(26)="Include the Crowd Pleaser Shotgun"
U2WeaponDisplayText(27)="Replace this with the Crowd Pleaser"
U2WeaponDisplayText(28)="Include the Field Generator"
U2WeaponDisplayText(29)="Include the Proximity Sensor"
U2WeaponDisplayText(30)="Firepower damping percentage"
U2WeaponDisplayText(31)="Integrate with Shield Reward"
U2WeaponDisplayText(32)="Concussion grenade behaviour"
U2WeaponDescText(0)="Include the M32 Duster Combat Assault Rifle in the game, i.e. enable it?"
U2WeaponDescText(1)="What weapon should be replaced with the CAR. By default it's the Minigun."
U2WeaponDescText(2)="Enable the Shock Lance Energy Rifle?"
U2WeaponDescText(3)="What weapon should be replaced with the Energy Rifle. By default it's the Assault Rifle. NOTE: Changing this value is not recommended."
U2WeaponDescText(4)="If enabled, this option will make all weapon firepower the same as in Unreal II XMP; if not, the firepower is consistent with Unreal II SP."
U2WeaponDescText(5)="If enabled, will make the Shock Lance use another, limited, secondary fire mode and allow Combat Assault Rifle use Unreal: Return to Na Pali fire style (shooting out of 2 barrels)."
U2WeaponDescText(6)="Enable the Vulcan Flamethrower?"
U2WeaponDescText(7)="What weapon should be replaced with the Flamethrower. By default it's the Bio Rifle."
U2WeaponDescText(8)="Enable the Magnum Pistol?"
U2WeaponDescText(9)="What weapon should be replaced with the Magnum Pistol. By default it's the Shock Rifle."
U2WeaponDescText(10)="Enable the Automatic Turret?"
U2WeaponDescText(11)="What weapon should be replaced with the Auto Turret. By default it's the Onslaught Grenade Launcher."
U2WeaponDescText(12)="Enable the Shark Rocket Launcher?"
U2WeaponDescText(13)="What weapon should be replaced with the Shark Rocket Launcher. By default it's the Rocket Launcher."
U2WeaponDescText(14)="Enable the Hydra Grenade Launcher?"
U2WeaponDescText(15)="What weapon should be replaced with the Hydra Grenade Launcher. By default it's the Flak Cannon."
U2WeaponDescText(16)="Should the Lightning Gun be replaced with the Widowmaker Sniper Rifle?"
U2WeaponDescText(17)="What weapon should be replaced with the Widowmaker Sniper Rifle. By default it's the Lightning Gun here."
U2WeaponDescText(18)="Should the Classic Sniper Rifle be replaced with the Widowmaker Sniper Rifle?"
U2WeaponDescText(19)="What weapon should be replaced with the Widowmaker Sniper Rifle. By default it's the Classic Sniper Rifle here."
U2WeaponDescText(20)="Enable the Rocket Turret delpoyable?"
U2WeaponDescText(21)="What weapon should be replaced with the Rocket Turret deployable. By default it's the Mine Layer."
U2WeaponDescText(22)="Enable the Land Mine?"
U2WeaponDescText(23)="What weapon should be replaced with the Land Mine. By default it's the Redeemer."
U2WeaponDescText(24)="Enable the Laser Trip Mine?"
U2WeaponDescText(25)="What weapon should be replaced with the Laser Trip Mine. By default it's the Ion Painter."
U2WeaponDescText(26)="Enable the Crowd Pleaser Shotgun? It won't replace the Link Gun in matches with vehicles."
U2WeaponDescText(27)="What weapon should be replaced with the Crowd Pleaser Shotgun. By default it's the Link Gun. It does not replace it in vehicle matches."
U2WeaponDescText(28)="Enable the Field Generator? If enabled, you start with one."
U2WeaponDescText(29)="Enable the Proximity Sensor? If enabled, you start with one."
U2WeaponDescText(30)="This number controls how powerful all weapons are. By deafult the firepower is set to 55% of the original in order to compensate for the fact that players in UT2004 don't have shields or damage filtering."
U2WeaponDescText(31)="If checked, the Shield Reward mutator produces Unreal II shield pickups."
U2WeaponDescText(32)="Choose between no white overlay, overlay depending on the player's view (XMP style) and overlay depending on the distance from the player (default, foolproof)."
//FirePowerMode=4
DamagePercentage=55
bUseXMPFeel=False
bIntegrateShieldReward=True
FlashbangModeString="FM_DistanceBased"
GroupName="Arena"
FriendlyName="Unreal II or XMP Weapons"
Description="Add the Unreal II weapons to other gametypes. Fully customisable, you can choose between Unreal II and XMP weapon behaviour."
}

View File

@@ -0,0 +1,10 @@
class US3HelloWorld extends GameInfo;
event InitGame( string Options, out string Error )
{
`log( "Hello, world!" );
}
defaultproperties
{
}