<commit_before>/*******************************************************************************
 * This file is part of TERMINAL RECALL
 * Copyright (c) 2012-2014 <NAME>
 * Part of the jTRFP.org project
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     chuck - initial API and implementation
 ******************************************************************************/
package org.jtrfp.trcl.beh;

import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.jtrfp.trcl.gpu.Model;
import org.jtrfp.trcl.obj.WorldObject;

public class DebrisOnDeathBehavior extends Behavior implements DeathListener {
    private final double MAX_SPEED=110000;
    private final int MIN_FRAGS=12;
    @Override
    public void notifyDeath() {
	WorldObject p = getParent();
	final double maxVertexValue;
	final Model model = p.getModel();
	if(model.getTriangleList()!=null)
	    maxVertexValue=model.getTriangleList().getMaximumVertexValue();
	else if(model.getTransparentTriangleList()!=null)
	    maxVertexValue=model.getTransparentTriangleList().getMaximumVertexValue();
	else return;//Give up
	for(int i=0; i<MIN_FRAGS+maxVertexValue/4000; i++){
	    final Vector3D oldPos = p.probeForBehavior(DeathBehavior.class).getLocationOfLastDeath();
	    p.getTr().getResourceManager().getDebrisSystem().spawn(oldPos, 
	    new Vector3D(
		Math.random()*MAX_SPEED-MAX_SPEED/2.,
		Math.random()*MAX_SPEED+60000,
		Math.random()*MAX_SPEED-MAX_SPEED/2.));
	}//end for(NUM_FRAGS)
    }//end constructor
}//end DebrisOnDeathBehavior
<commit_msg>Debris explosion initial velocity now skewed by source velocity.<commit_after>/*******************************************************************************
 * This file is part of TERMINAL RECALL
 * Copyright (c) 2012-2014 <NAME>
 * Part of the jTRFP.org project
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     chuck - initial API and implementation
 ******************************************************************************/
package org.jtrfp.trcl.beh;

import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.jtrfp.trcl.beh.phy.MovesByVelocity;
import org.jtrfp.trcl.gpu.Model;
import org.jtrfp.trcl.obj.WorldObject;

public class DebrisOnDeathBehavior extends Behavior implements DeathListener {
    private final double MAX_SPEED=110000;
    private final int MIN_FRAGS=12;
    @Override
    public void notifyDeath() {
	WorldObject p = getParent();
	final double maxVertexValue;
	final Model model = p.getModel();
	if(model.getTriangleList()!=null)
	    maxVertexValue=model.getTriangleList().getMaximumVertexValue();
	else if(model.getTransparentTriangleList()!=null)
	    maxVertexValue=model.getTransparentTriangleList().getMaximumVertexValue();
	else return;//Give up
	Vector3D velocity = Vector3D.ZERO;
	try{velocity = p.probeForBehavior(MovesByVelocity.class).getVelocity().scalarMultiply(.75);}
	catch(BehaviorNotFoundException e){}
	for(int i=0; i<MIN_FRAGS+maxVertexValue/4000; i++){
	    final Vector3D oldPos = p.probeForBehavior(DeathBehavior.class).getLocationOfLastDeath();
	    p.getTr().getResourceManager().getDebrisSystem().spawn(oldPos, 
	    new Vector3D(
		velocity.getX()+Math.random()*MAX_SPEED-MAX_SPEED/2.,
		velocity.getY()+Math.random()*MAX_SPEED+60000,
		velocity.getZ()+Math.random()*MAX_SPEED-MAX_SPEED/2.));
	}//end for(NUM_FRAGS)
    }//end constructor
}//end DebrisOnDeathBehavior

{'fraction_non_alphanumeric': 0.1850785340314136, 'fraction_numerical': 0.018848167539267015, 'mean_word_length': 5.454391891891892, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7389722', 'n_tokens_mistral': 1235, 'n_tokens_neox': 1126, 'n_words': 253}